--[[ WARNING: Heads up! This script has not been verified by ScriptBlox. Use at your own risk! ]] -- Portal Gun Rick & Morty | Delta -- + Control de rango -- + Botones circulares en pantalla -- + Sistema "Editar Hub" (mover / tamaño / bloquear) -- + Adaptación correcta a paredes / piso / techo -- + Corregido: el botón Coords ya no teletransporta / no detecta el mundo detrás local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local TweenService = game:GetService("TweenService") local Debris = game:GetService("Debris") local GuiService = game:GetService("GuiService") 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 = personaje | 2 = cámara -- ===================== RANGO ===================== local portalRange = 90 -- ===================== BOTONES CIRCULARES (HUD) ===================== local editMode = false local buttonsLocked = false local buttonSize = 72 local insertBtn, createBtn local insertDragging = false local createDragging = false local insertDragStart, insertStartPos local createDragStart, createStartPos -- Posiciones por defecto local insertPos = UDim2.new(0.82, 0, 0.55, 0) local createPos = UDim2.new(0.82, 0, 0.68, 0) -- ===================== 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 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 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 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 maxRange = math.clamp(portalRange, 5, 500) local result = workspace:Raycast(startPos, aimDirection * maxRange, rayParams) local targetPos local normal if result 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 -- Piso targetPos = targetPos + Vector3.new(0, portalHalfHeight, 0) else -- Techo targetPos = targetPos - Vector3.new(0, portalHalfHeight * 0.35, 0) end end else targetPos = startPos + (aimDirection * maxRange) normal = -aimDirection end 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() 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 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 if not exitPortal or not exitPortal.Parent then local exitPos = destination + Vector3.new(0, 3.7, 0) local lookDir = hrp.CFrame.LookVector exitPortal = createPortalVisual(exitPos, lookDir) 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 hrp.CFrame = CFrame.new(destination + Vector3.new(0, 3, 0)) task.wait(1) debounce = false end end) scheduleDisappear() isFiring = false end -- ===================== ACTUALIZAR TAMAÑO BOTONES ===================== local function updateButtonSizes() if insertBtn then insertBtn.Size = UDim2.new(0, buttonSize, 0, buttonSize) end if createBtn then createBtn.Size = UDim2.new(0, buttonSize, 0, buttonSize) end end -- ===================== DETECTAR SI EL MOUSE ESTÁ SOBRE GUI ===================== local function isMouseOverGui() local mousePos = UserInputService:GetMouseLocation() local guisAtPos = GuiService:GetGuiObjectsAtPosition(mousePos.X, mousePos.Y) return #guisAtPos > 0 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") -- ========== BOTONES CIRCULARES (siempre visibles) ========== insertBtn = Instance.new("TextButton") insertBtn.Name = "InsertBtn" insertBtn.Size = UDim2.new(0, buttonSize, 0, buttonSize) insertBtn.Position = insertPos insertBtn.BackgroundColor3 = Color3.fromRGB(0, 140, 90) insertBtn.Text = "Coords" insertBtn.TextColor3 = Color3.new(1, 1, 1) insertBtn.Font = Enum.Font.GothamBold insertBtn.TextSize = 13 insertBtn.TextWrapped = true insertBtn.AutoButtonColor = true insertBtn.Active = true insertBtn.Parent = gui Instance.new("UICorner", insertBtn).CornerRadius = UDim.new(1, 0) local insertStroke = Instance.new("UIStroke", insertBtn) insertStroke.Color = Color3.fromRGB(0, 255, 140) insertStroke.Thickness = 2.5 createBtn = Instance.new("TextButton") createBtn.Name = "CreateBtn" createBtn.Size = UDim2.new(0, buttonSize, 0, buttonSize) createBtn.Position = createPos createBtn.BackgroundColor3 = Color3.fromRGB(0, 200, 80) createBtn.Text = "Portal" createBtn.TextColor3 = Color3.new(1, 1, 1) createBtn.Font = Enum.Font.GothamBold createBtn.TextSize = 14 createBtn.TextWrapped = true createBtn.AutoButtonColor = true createBtn.Active = true createBtn.Parent = gui Instance.new("UICorner", createBtn).CornerRadius = UDim.new(1, 0) local createStroke = Instance.new("UIStroke", createBtn) createStroke.Color = Color3.fromRGB(0, 255, 120) createStroke.Thickness = 2.5 -- ========== FRAME PRINCIPAL (HUB) ========== mainFrame = Instance.new("Frame") mainFrame.Size = UDim2.new(0, 280, 0, 380) mainFrame.Position = UDim2.new(0.72, 0, 0.15, 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 return l 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) -- Rango makeLabel("Rango de la pistola (studs):", 60) local rangeBox = Instance.new("TextBox") rangeBox.Size = UDim2.new(1, 0, 0, 30) rangeBox.Position = UDim2.new(0, 0, 0, 82) rangeBox.BackgroundColor3 = Color3.fromRGB(40, 40, 50) rangeBox.Text = tostring(portalRange) rangeBox.TextColor3 = Color3.new(1,1,1) rangeBox.Font = Enum.Font.GothamBold rangeBox.TextSize = 16 rangeBox.PlaceholderText = "Ej: 50, 100, 200..." rangeBox.ClearTextOnFocus = false rangeBox.Parent = content Instance.new("UICorner", rangeBox).CornerRadius = UDim.new(0, 8) local rangeStroke = Instance.new("UIStroke", rangeBox) rangeStroke.Color = Color3.fromRGB(0, 220, 100) rangeStroke.Thickness = 1.5 rangeBox.FocusLost:Connect(function() local newRange = tonumber(rangeBox.Text) if newRange then portalRange = math.clamp(newRange, 5, 500) rangeBox.Text = tostring(portalRange) else rangeBox.Text = tostring(portalRange) end end) -- Modo de apuntado local modeBtn = Instance.new("TextButton") modeBtn.Size = UDim2.new(1, 0, 0, 32) modeBtn.Position = UDim2.new(0, 0, 0, 125) 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) 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) -- ========== CONTROLES DE EDICIÓN ========== makeLabel("── Personalizar Hub ──", 170) makeLabel("Tamaño de los botones:", 195) local sizeBox = Instance.new("TextBox") sizeBox.Size = UDim2.new(0.45, 0, 0, 28) sizeBox.Position = UDim2.new(0, 0, 0, 217) sizeBox.BackgroundColor3 = Color3.fromRGB(40, 40, 50) sizeBox.Text = tostring(buttonSize) sizeBox.TextColor3 = Color3.new(1,1,1) sizeBox.Font = Enum.Font.GothamBold sizeBox.TextSize = 15 sizeBox.Parent = content Instance.new("UICorner", sizeBox).CornerRadius = UDim.new(0, 6) local applySizeBtn = Instance.new("TextButton") applySizeBtn.Size = UDim2.new(0.5, -6, 0, 28) applySizeBtn.Position = UDim2.new(0.5, 6, 0, 217) applySizeBtn.BackgroundColor3 = Color3.fromRGB(60, 60, 80) applySizeBtn.Text = "Aplicar tamaño" applySizeBtn.TextColor3 = Color3.new(1,1,1) applySizeBtn.Font = Enum.Font.GothamBold applySizeBtn.TextSize = 12 applySizeBtn.Parent = content Instance.new("UICorner", applySizeBtn).CornerRadius = UDim.new(0, 6) applySizeBtn.MouseButton1Click:Connect(function() local newSize = tonumber(sizeBox.Text) if newSize then buttonSize = math.clamp(newSize, 40, 140) sizeBox.Text = tostring(buttonSize) updateButtonSizes() else sizeBox.Text = tostring(buttonSize) end end) -- Botón Bloquear / Desbloquear local lockBtn = Instance.new("TextButton") lockBtn.Size = UDim2.new(1, 0, 0, 30) lockBtn.Position = UDim2.new(0, 0, 0, 255) lockBtn.BackgroundColor3 = Color3.fromRGB(80, 50, 50) lockBtn.Text = "🔒 Posiciones: DESBLOQUEADAS" lockBtn.TextColor3 = Color3.new(1,1,1) lockBtn.Font = Enum.Font.GothamBold lockBtn.TextSize = 13 lockBtn.Parent = content Instance.new("UICorner", lockBtn).CornerRadius = UDim.new(0, 8) lockBtn.MouseButton1Click:Connect(function() buttonsLocked = not buttonsLocked if buttonsLocked then lockBtn.Text = "🔓 Posiciones: BLOQUEADAS" lockBtn.BackgroundColor3 = Color3.fromRGB(40, 100, 50) else lockBtn.Text = "🔒 Posiciones: DESBLOQUEADAS" lockBtn.BackgroundColor3 = Color3.fromRGB(80, 50, 50) end end) -- Botón principal: Editar Hub local editHubBtn = Instance.new("TextButton") editHubBtn.Size = UDim2.new(1, 0, 0, 38) editHubBtn.Position = UDim2.new(0, 0, 0, 295) editHubBtn.BackgroundColor3 = Color3.fromRGB(0, 160, 110) editHubBtn.Text = "✏️ Editar Hub" editHubBtn.TextColor3 = Color3.new(1,1,1) editHubBtn.Font = Enum.Font.GothamBold editHubBtn.TextSize = 16 editHubBtn.Parent = content Instance.new("UICorner", editHubBtn).CornerRadius = UDim.new(0, 8) local info = Instance.new("TextLabel") info.Size = UDim2.new(1, 0, 0, 30) info.Position = UDim2.new(0, 0, 0, 338) info.BackgroundTransparency = 1 info.Text = "En modo edición puedes arrastrar los botones circulares" info.TextColor3 = Color3.fromRGB(140, 140, 140) info.Font = Enum.Font.Gotham info.TextSize = 11 info.TextWrapped = true info.Parent = content -- ========== LÓGICA DE LOS BOTONES CIRCULARES ========== local function setEditVisual(active) if active then insertStroke.Color = Color3.fromRGB(255, 220, 50) createStroke.Color = Color3.fromRGB(255, 220, 50) insertStroke.Thickness = 3.5 createStroke.Thickness = 3.5 editHubBtn.Text = "✅ Guardar y Salir" editHubBtn.BackgroundColor3 = Color3.fromRGB(200, 140, 20) else insertStroke.Color = Color3.fromRGB(0, 255, 140) createStroke.Color = Color3.fromRGB(0, 255, 120) insertStroke.Thickness = 2.5 createStroke.Thickness = 2.5 editHubBtn.Text = "✏️ Editar Hub" editHubBtn.BackgroundColor3 = Color3.fromRGB(0, 160, 110) end end editHubBtn.MouseButton1Click:Connect(function() editMode = not editMode setEditVisual(editMode) if not editMode then insertPos = insertBtn.Position createPos = createBtn.Position end end) -- Clic normal (solo si NO estás en modo edición) insertBtn.MouseButton1Click:Connect(function() if editMode then return end 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() if editMode then return end local newRange = tonumber(rangeBox.Text) if newRange then portalRange = math.clamp(newRange, 5, 500) rangeBox.Text = tostring(portalRange) end 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) -- Arrastrar botones circulares (solo en modo edición y desbloqueados) insertBtn.InputBegan:Connect(function(input) if not editMode or buttonsLocked then return end if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then insertDragging = true insertDragStart = input.Position insertStartPos = insertBtn.Position end end) insertBtn.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then insertDragging = false end end) createBtn.InputBegan:Connect(function(input) if not editMode or buttonsLocked then return end if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then createDragging = true createDragStart = input.Position createStartPos = createBtn.Position end end) createBtn.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then createDragging = false end end) UserInputService.InputChanged:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then if insertDragging and editMode and not buttonsLocked then local delta = input.Position - insertDragStart insertBtn.Position = UDim2.new( insertStartPos.X.Scale, insertStartPos.X.Offset + delta.X, insertStartPos.Y.Scale, insertStartPos.Y.Offset + delta.Y ) end if createDragging and editMode and not buttonsLocked then local delta = input.Position - createDragStart createBtn.Position = UDim2.new( createStartPos.X.Scale, createStartPos.X.Offset + delta.X, createStartPos.Y.Scale, createStartPos.Y.Offset + delta.Y ) end end end) -- Minimizar / Cerrar / Arrastrar frame minBtn.MouseButton1Click:Connect(function() minimized = not minimized content.Visible = not minimized mainFrame.Size = minimized and UDim2.new(0, 280, 0, 34) or UDim2.new(0, 280, 0, 380) 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 del mouse (solo si NO estás sobre la GUI) 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 -- Evita que el clic en los botones de la GUI actualice las coordenadas if isMouseOverGui() then return end 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 | Botón Coords ya no interfiere con el mundo")