--[[ WARNING: Heads up! This script has not been verified by ScriptBlox. Use at your own risk! ]] -- Portal Gun Rick & Morty | Delta -- Mejoras: -- 1. No se pega a paredes lejanas (solo si estás cerca) -- 2. Modo de apuntado 1 (personaje) / 2 (cámara) -- 3. Se alinea correctamente a piso, techo, paredes, etc. -- 4. Solo se pueden lanzar portales con la pistola equipada -- 5. El segundo portal se orienta hacia donde mira el personaje -- + Cooldown 1s + Desaparición a los 7s con animación 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 local aimMode = 1 -- 1 = mira del personaje | 2 = mira de la cámara -- ===================== 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, normal) 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.Name = "Ring" 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.Name = "PortalLight" portalLight.Color = Color3.fromRGB(0, 255, 100) portalLight.Brightness = 0.8 portalLight.Range = 8 portalLight.Parent = portal -- Orientación correcta según la normal / dirección local portalCFrame = CFrame.lookAt(position, position + normal) * 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 -- ===================== ANIMACIÓN DE DESAPARICIÓN ===================== local function disappearPortal(portal) if not portal or not portal.Parent then return end local ring = portal:FindFirstChild("Ring") local light = portal:FindFirstChild("PortalLight") local shrinkInfo = TweenInfo.new(0.45, Enum.EasingStyle.Back, Enum.EasingDirection.In) local portalTween = TweenService:Create(portal, shrinkInfo, { Size = Vector3.new(0.05, 0.35, 0.25), Transparency = 1 }) if ring then TweenService:Create(ring, shrinkInfo, { Size = Vector3.new(0.08, 0.45, 0.35), Transparency = 1 }):Play() end if light then TweenService:Create(light, shrinkInfo, { Brightness = 0, Range = 0 }):Play() end portalTween:Play() portalTween.Completed:Wait() if portal and portal.Parent then portal:Destroy() end end -- ===================== DISPARO ===================== local function firePortal(destination) if isFiring then return end -- Solo se puede disparar con la pistola equipada local character = player.Character if not character then return end local equippedGun = character:FindFirstChild("PortalGun") if not equippedGun or not equippedGun:IsA("Tool") then return end isFiring = true local hrp = character:FindFirstChild("HumanoidRootPart") if not hrp then isFiring = false return end -- Dirección según el modo de apuntado local aimDirection if aimMode == 1 then aimDirection = hrp.CFrame.LookVector else aimDirection = camera.CFrame.LookVector end local startPos = hrp.Position + (aimDirection * 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, aimDirection * 90, rayParams) local CLOSE_DISTANCE = 12 local DEFAULT_DISTANCE = 18 local targetPos local normal if result and (result.Position - startPos).Magnitude <= CLOSE_DISTANCE then normal = result.Normal targetPos = result.Position + normal * 0.35 local portalHalfHeight = 3.7 if math.abs(normal.Y) > 0.7 then if normal.Y > 0 then targetPos = targetPos + Vector3.new(0, portalHalfHeight, 0) else targetPos = targetPos - Vector3.new(0, portalHalfHeight * 0.3, 0) end end else targetPos = startPos + (aimDirection * DEFAULT_DISTANCE) normal = -aimDirection 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 local entrancePos = targetPos local exitPortal = nil local debounce = false local function scheduleDisappear() task.delay(7, function() task.spawn(function() disappearPortal(entrancePortal) end) task.spawn(function() disappearPortal(exitPortal) end) if currentPortal == entrancePortal then currentPortal = nil end end) end -- Conexión del portal de ENTRADA → va al destino 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 -- Crear portal de salida orientado hacia donde mira el personaje if not exitPortal or not exitPortal.Parent then local exitPos = destination + Vector3.new(0, 3.7, 0) local lookDir = hrp.CFrame.LookVector -- Dirección en la que mira el personaje exitPortal = createPortalVisual(exitPos, lookDir) -- Conexión del portal de SALIDA → regresa a la entrada exitPortal.Touched:Connect(function(hit2) if debounce then return end local char2 = hit2.Parent if char2 == player.Character and char2:FindFirstChild("HumanoidRootPart") then debounce = true char2.HumanoidRootPart.CFrame = CFrame.new(entrancePos + Vector3.new(0, 3, 0)) task.wait(1) debounce = false end end) end -- Teletransportar al jugador hrp.CFrame = CFrame.new(destination + Vector3.new(0, 3, 0)) task.wait(1) debounce = false end end) scheduleDisappear() 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, 295) mainFrame.Position = UDim2.new(0.72, 0, 0.22, 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, 100) 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 modeBtn = Instance.new("TextButton") modeBtn.Size = UDim2.new(1, 0, 0, 32) modeBtn.Position = UDim2.new(0, 0, 0, 145) modeBtn.BackgroundColor3 = Color3.fromRGB(40, 90, 160) modeBtn.Text = "Modo de apuntado: 1" modeBtn.TextColor3 = Color3.new(1,1,1) modeBtn.Font = Enum.Font.GothamBold modeBtn.TextSize = 14 modeBtn.Parent = content Instance.new("UICorner", modeBtn).CornerRadius = UDim.new(0, 8) local info = Instance.new("TextLabel") info.Size = UDim2.new(1, 0, 0, 50) info.Position = UDim2.new(0, 0, 0, 185) info.BackgroundTransparency = 1 info.Text = "Modo 1 = Mira del personaje\nModo 2 = Mira de la cámara\nDebes tener la pistola equipada" 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) modeBtn.MouseButton1Click:Connect(function() if aimMode == 1 then aimMode = 2 modeBtn.Text = "Modo de apuntado: 2" modeBtn.BackgroundColor3 = Color3.fromRGB(140, 70, 30) else aimMode = 1 modeBtn.Text = "Modo de apuntado: 1" modeBtn.BackgroundColor3 = Color3.fromRGB(40, 90, 160) 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, 295) 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 | Segundo portal orientado hacia donde mira el personaje")