-- Portal Gun Rick & Morty | Delta | Ajuste de altura (no atraviesa el piso) local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local TweenService = game:GetService("TweenService") local Debris = game:GetService("Debris") local player = Players.LocalPlayer local mouse = player:GetMouse() local camera = workspace.CurrentCamera local lastCoords = Vector3.new(0, 10, 0) local currentPortal = nil local gui, mainFrame local minimized = false local dragging = false local dragStart, startPos local isFiring = false -- ===================== PISTOLA ===================== local function giveGun() local backpack = player:WaitForChild("Backpack") if backpack:FindFirstChild("PortalGun") then return end local tool = Instance.new("Tool") tool.Name = "PortalGun" tool.RequiresHandle = true tool.CanBeDropped = false tool.ToolTip = "Pistola de Portales - Rick Sanchez" local handle = Instance.new("Part") handle.Name = "Handle" handle.Size = Vector3.new(0.7, 0.55, 2.4) handle.Color = Color3.fromRGB(190, 190, 200) handle.Material = Enum.Material.Metal handle.Parent = tool local grip = Instance.new("Part") grip.Size = Vector3.new(0.45, 1.1, 0.5) grip.Color = Color3.fromRGB(40, 40, 45) grip.Material = Enum.Material.SmoothPlastic grip.CanCollide = false grip.Parent = tool local weldGrip = Instance.new("Weld") weldGrip.Part0 = handle weldGrip.Part1 = grip weldGrip.C0 = CFrame.new(0, -0.7, 0.3) * CFrame.Angles(math.rad(-15), 0, 0) weldGrip.Parent = handle local fluid = Instance.new("Part") fluid.Size = Vector3.new(0.55, 0.55, 1.1) fluid.Color = Color3.fromRGB(0, 255, 70) fluid.Material = Enum.Material.Neon fluid.CanCollide = false fluid.Parent = tool local weldFluid = Instance.new("Weld") weldFluid.Part0 = handle weldFluid.Part1 = fluid weldFluid.C0 = CFrame.new(0, 0.45, -0.15) weldFluid.Parent = handle local topTube = Instance.new("Part") topTube.Size = Vector3.new(0.25, 0.25, 1.6) topTube.Color = Color3.fromRGB(160, 160, 170) topTube.Material = Enum.Material.Metal topTube.CanCollide = false topTube.Parent = tool local weldTube = Instance.new("Weld") weldTube.Part0 = handle weldTube.Part1 = topTube weldTube.C0 = CFrame.new(0, 0.55, 0.1) weldTube.Parent = handle local barrel = Instance.new("Part") barrel.Size = Vector3.new(0.4, 0.4, 0.7) barrel.Color = Color3.fromRGB(50, 50, 55) barrel.Material = Enum.Material.Metal barrel.CanCollide = false barrel.Parent = tool local weldBarrel = Instance.new("Weld") weldBarrel.Part0 = handle weldBarrel.Part1 = barrel weldBarrel.C0 = CFrame.new(0, 0.1, -1.45) weldBarrel.Parent = handle local tip = Instance.new("Part") tip.Size = Vector3.new(0.28, 0.28, 0.2) tip.Color = Color3.fromRGB(0, 255, 90) tip.Material = Enum.Material.Neon tip.CanCollide = false tip.Parent = tool local weldTip = Instance.new("Weld") weldTip.Part0 = barrel weldTip.Part1 = tip weldTip.C0 = CFrame.new(0, 0, -0.4) weldTip.Parent = barrel tool.Parent = backpack end -- ===================== CREAR PORTAL VISUAL ===================== local function createPortalVisual(position, facingDirection) local portal = Instance.new("Part") portal.Name = "PortalVisual" portal.Anchored = true portal.CanCollide = false portal.Material = Enum.Material.Neon portal.Color = Color3.fromRGB(0, 255, 80) portal.Transparency = 0.12 portal.Size = Vector3.new(0.05, 0.35, 0.25) portal.Parent = workspace local mesh = Instance.new("SpecialMesh") mesh.MeshType = Enum.MeshType.Cylinder mesh.Parent = portal local ring = Instance.new("Part") ring.Anchored = true ring.CanCollide = false ring.Material = Enum.Material.Neon ring.Color = Color3.fromRGB(0, 220, 50) ring.Transparency = 0.35 ring.Size = Vector3.new(0.08, 0.45, 0.35) ring.Parent = portal local ringMesh = Instance.new("SpecialMesh") ringMesh.MeshType = Enum.MeshType.Cylinder ringMesh.Parent = ring local portalLight = Instance.new("PointLight") portalLight.Color = Color3.fromRGB(0, 255, 100) portalLight.Brightness = 0.8 portalLight.Range = 8 portalLight.Parent = portal local portalCFrame = CFrame.lookAt(position, position + facingDirection) * CFrame.Angles(0, math.rad(90), 0) portal.CFrame = portalCFrame ring.CFrame = portalCFrame local expandInfo = TweenInfo.new(0.4, Enum.EasingStyle.Back, Enum.EasingDirection.Out) TweenService:Create(portal, expandInfo, { Size = Vector3.new(0.3, 7.5, 5.7) }):Play() TweenService:Create(ring, expandInfo, { Size = Vector3.new(0.4, 8.4, 6.4) }):Play() TweenService:Create(portalLight, expandInfo, { Brightness = 3.5, Range = 18 }):Play() return portal end -- ===================== DISPARO ===================== local function firePortal(destination) if isFiring then return end isFiring = true local character = player.Character if not character then isFiring = false return end local hrp = character:FindFirstChild("HumanoidRootPart") if not hrp then isFiring = false return end local lookVector = hrp.CFrame.LookVector local startPos = hrp.Position + (lookVector * 2.2) + Vector3.new(0, 1.4, 0) local rayParams = RaycastParams.new() rayParams.FilterDescendantsInstances = {character} rayParams.FilterType = Enum.RaycastFilterType.Exclude local result = workspace:Raycast(startPos, lookVector * 90, rayParams) local targetPos local normal if result then targetPos = result.Position + result.Normal * 0.4 normal = result.Normal else targetPos = startPos + (lookVector * 20) normal = -lookVector end -- ===== AJUSTE DE ALTURA (no atraviesa el piso) ===== local portalHalfHeight = 3.7 if normal.Y > 0.55 then -- Es suelo → subir el centro del portal targetPos = targetPos + Vector3.new(0, portalHalfHeight, 0) end -- ================================================== -- Pelotita local ball = Instance.new("Part") ball.Name = "PortalBall" ball.Shape = Enum.PartType.Ball ball.Size = Vector3.new(0.55, 0.55, 0.55) ball.Color = Color3.fromRGB(0, 255, 80) ball.Material = Enum.Material.Neon ball.Anchored = true ball.CanCollide = false ball.CastShadow = false ball.Position = startPos ball.Parent = workspace local light = Instance.new("PointLight") light.Color = Color3.fromRGB(0, 255, 100) light.Brightness = 2.5 light.Range = 10 light.Parent = ball local tweenInfo = TweenInfo.new(0.32, Enum.EasingStyle.Quad, Enum.EasingDirection.Out) local moveTween = TweenService:Create(ball, tweenInfo, { Position = targetPos, Size = Vector3.new(1.2, 1.2, 1.2) }) moveTween:Play() moveTween.Completed:Wait() ball:Destroy() -- Portal de entrada if currentPortal and currentPortal.Parent then currentPortal:Destroy() end local entrancePortal = createPortalVisual(targetPos, normal) currentPortal = entrancePortal -- Teletransporte + portal en destino local debounce = false entrancePortal.Touched:Connect(function(hit) if debounce then return end local char = hit.Parent if char == player.Character and char:FindFirstChild("HumanoidRootPart") then debounce = true local hrp = char.HumanoidRootPart -- Portal de destino también a buena altura local exitPos = destination + Vector3.new(0, 3.7, 0) local exitPortal = createPortalVisual(exitPos, Vector3.new(0, 0, -1)) -- Teletransportar al jugador (pies en el suelo) hrp.CFrame = CFrame.new(destination + Vector3.new(0, 3, 0)) task.delay(4, function() if exitPortal and exitPortal.Parent then exitPortal:Destroy() end end) task.wait(1.2) debounce = false end end) Debris:AddItem(entrancePortal, 60) isFiring = false end -- ===================== GUI ===================== local function createGUI() if gui then gui:Destroy() end gui = Instance.new("ScreenGui") gui.Name = "PortalGunGUI" gui.ResetOnSpawn = false gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling gui.Parent = player:WaitForChild("PlayerGui") mainFrame = Instance.new("Frame") mainFrame.Size = UDim2.new(0, 270, 0, 250) mainFrame.Position = UDim2.new(0.72, 0, 0.28, 0) mainFrame.BackgroundColor3 = Color3.fromRGB(22, 22, 30) mainFrame.BorderSizePixel = 0 mainFrame.Active = true mainFrame.Parent = gui Instance.new("UICorner", mainFrame).CornerRadius = UDim.new(0, 12) local stroke = Instance.new("UIStroke", mainFrame) stroke.Color = Color3.fromRGB(0, 255, 100) stroke.Thickness = 2 local titleBar = Instance.new("Frame") titleBar.Size = UDim2.new(1, 0, 0, 34) titleBar.BackgroundColor3 = Color3.fromRGB(0, 170, 60) titleBar.BorderSizePixel = 0 titleBar.Parent = mainFrame Instance.new("UICorner", titleBar).CornerRadius = UDim.new(0, 12) local title = Instance.new("TextLabel") title.Size = UDim2.new(1, -75, 1, 0) title.Position = UDim2.new(0, 10, 0, 0) title.BackgroundTransparency = 1 title.Text = "Pistola de Portales" title.TextColor3 = Color3.new(1,1,1) title.Font = Enum.Font.GothamBold title.TextSize = 15 title.TextXAlignment = Enum.TextXAlignment.Left title.Parent = titleBar local minBtn = Instance.new("TextButton") minBtn.Size = UDim2.new(0, 28, 0, 28) minBtn.Position = UDim2.new(1, -62, 0, 3) minBtn.BackgroundColor3 = Color3.fromRGB(35, 35, 45) minBtn.Text = "─" minBtn.TextColor3 = Color3.new(1,1,1) minBtn.Font = Enum.Font.GothamBold minBtn.TextSize = 16 minBtn.Parent = titleBar Instance.new("UICorner", minBtn).CornerRadius = UDim.new(0, 6) local closeBtn = Instance.new("TextButton") closeBtn.Size = UDim2.new(0, 28, 0, 28) closeBtn.Position = UDim2.new(1, -30, 0, 3) closeBtn.BackgroundColor3 = Color3.fromRGB(180, 40, 40) closeBtn.Text = "X" closeBtn.TextColor3 = Color3.new(1,1,1) closeBtn.Font = Enum.Font.GothamBold closeBtn.TextSize = 14 closeBtn.Parent = titleBar Instance.new("UICorner", closeBtn).CornerRadius = UDim.new(0, 6) local content = Instance.new("Frame") content.Name = "Content" content.Size = UDim2.new(1, -20, 1, -50) content.Position = UDim2.new(0, 10, 0, 42) content.BackgroundTransparency = 1 content.Parent = mainFrame local function makeLabel(text, y) local l = Instance.new("TextLabel") l.Size = UDim2.new(1, 0, 0, 18) l.Position = UDim2.new(0, 0, 0, y) l.BackgroundTransparency = 1 l.Text = text l.TextColor3 = Color3.fromRGB(180, 180, 180) l.Font = Enum.Font.Gotham l.TextSize = 13 l.TextXAlignment = Enum.TextXAlignment.Left l.Parent = content end makeLabel("Coordenadas destino:", 0) local xBox = Instance.new("TextBox") xBox.Size = UDim2.new(0.3, -4, 0, 28) xBox.Position = UDim2.new(0, 0, 0, 22) xBox.BackgroundColor3 = Color3.fromRGB(40, 40, 50) xBox.Text = "0" xBox.TextColor3 = Color3.new(1,1,1) xBox.Font = Enum.Font.Gotham xBox.TextSize = 14 xBox.PlaceholderText = "X" xBox.Parent = content Instance.new("UICorner", xBox).CornerRadius = UDim.new(0, 6) local yBox = Instance.new("TextBox") yBox.Size = UDim2.new(0.3, -4, 0, 28) yBox.Position = UDim2.new(0.35, 0, 0, 22) yBox.BackgroundColor3 = Color3.fromRGB(40, 40, 50) yBox.Text = "10" yBox.TextColor3 = Color3.new(1,1,1) yBox.Font = Enum.Font.Gotham yBox.TextSize = 14 yBox.PlaceholderText = "Y" yBox.Parent = content Instance.new("UICorner", yBox).CornerRadius = UDim.new(0, 6) local zBox = Instance.new("TextBox") zBox.Size = UDim2.new(0.3, -4, 0, 28) zBox.Position = UDim2.new(0.7, 0, 0, 22) zBox.BackgroundColor3 = Color3.fromRGB(40, 40, 50) zBox.Text = "0" zBox.TextColor3 = Color3.new(1,1,1) zBox.Font = Enum.Font.Gotham zBox.TextSize = 14 zBox.PlaceholderText = "Z" zBox.Parent = content Instance.new("UICorner", zBox).CornerRadius = UDim.new(0, 6) local insertBtn = Instance.new("TextButton") insertBtn.Size = UDim2.new(1, 0, 0, 32) insertBtn.Position = UDim2.new(0, 0, 0, 60) insertBtn.BackgroundColor3 = Color3.fromRGB(0, 140, 80) insertBtn.Text = "Insertar Coordenadas" insertBtn.TextColor3 = Color3.new(1,1,1) insertBtn.Font = Enum.Font.GothamBold insertBtn.TextSize = 14 insertBtn.Parent = content Instance.new("UICorner", insertBtn).CornerRadius = UDim.new(0, 8) local createBtn = Instance.new("TextButton") createBtn.Size = UDim2.new(1, 0, 0, 36) createBtn.Position = UDim2.new(0, 0, 0, 105) createBtn.BackgroundColor3 = Color3.fromRGB(0, 200, 90) createBtn.Text = "CREAR PORTAL" createBtn.TextColor3 = Color3.new(1,1,1) createBtn.Font = Enum.Font.GothamBold createBtn.TextSize = 16 createBtn.Parent = content Instance.new("UICorner", createBtn).CornerRadius = UDim.new(0, 8) local info = Instance.new("TextLabel") info.Size = UDim2.new(1, 0, 0, 40) info.Position = UDim2.new(0, 0, 0, 150) info.BackgroundTransparency = 1 info.Text = "Gira el personaje hacia donde quieres\nel portal y pulsa CREAR PORTAL" info.TextColor3 = Color3.fromRGB(140, 140, 140) info.Font = Enum.Font.Gotham info.TextSize = 12 info.TextWrapped = true info.Parent = content insertBtn.MouseButton1Click:Connect(function() xBox.Text = string.format("%.1f", lastCoords.X) yBox.Text = string.format("%.1f", lastCoords.Y) zBox.Text = string.format("%.1f", lastCoords.Z) end) createBtn.MouseButton1Click:Connect(function() local x = tonumber(xBox.Text) or 0 local y = tonumber(yBox.Text) or 10 local z = tonumber(zBox.Text) or 0 local dest = Vector3.new(x, y, z) task.spawn(function() firePortal(dest) end) end) minBtn.MouseButton1Click:Connect(function() minimized = not minimized content.Visible = not minimized mainFrame.Size = minimized and UDim2.new(0, 270, 0, 34) or UDim2.new(0, 270, 0, 250) end) closeBtn.MouseButton1Click:Connect(function() gui.Enabled = false end) titleBar.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = mainFrame.Position end end) titleBar.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = false end end) UserInputService.InputChanged:Connect(function(input) if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then local delta = input.Position - dragStart mainFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y) end end) end -- Guardar coordenadas local function updateCoords() local unitRay = camera:ScreenPointToRay(mouse.X, mouse.Y) local params = RaycastParams.new() params.FilterDescendantsInstances = {player.Character} params.FilterType = Enum.RaycastFilterType.Exclude local result = workspace:Raycast(unitRay.Origin, unitRay.Direction * 1000, params) if result then lastCoords = result.Position end end UserInputService.InputBegan:Connect(function(input, processed) if processed then return end if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then updateCoords() end end) UserInputService.TouchTapInWorld:Connect(function(_, processedByUI) if not processedByUI then updateCoords() end end) -- Inicio giveGun() createGUI() player.CharacterAdded:Connect(function() task.wait(1.2) giveGun() end) print("✅ Portal Gun | Altura ajustada (no atraviesa el piso)")