--// Coordinates Teller - one-shot on-screen button local Players = game:GetService("Players") local UIS = game:GetService("UserInputService") local lp = Players.LocalPlayer -- kill any previous instance if getgenv()._coordCleanup then pcall(getgenv()._coordCleanup) end local state = { conns = {} } getgenv()._coordCleanup = function() for _, c in ipairs(state.conns) do pcall(function() c:Disconnect() end) end if state.gui then pcall(function() state.gui:Destroy() end) end end local function getHRP() local char = lp.Character if not char then return nil end return char:FindFirstChild("HumanoidRootPart") end ------------------------------------------------------------ -- GUI ------------------------------------------------------------ local sg = Instance.new("ScreenGui") sg.Name = "CoordTellerGui" sg.ResetOnSpawn = false sg.IgnoreGuiInset = true sg.DisplayOrder = 999 do local ok = pcall(function() sg.Parent = gethui() end) if not ok or not sg.Parent then sg.Parent = lp:WaitForChild("PlayerGui") end end state.gui = sg local btn = Instance.new("TextButton") btn.Size = UDim2.fromOffset(120, 40) btn.Position = UDim2.new(0, 20, 0, 100) btn.BackgroundColor3 = Color3.fromRGB(45, 45, 50) btn.TextColor3 = Color3.fromRGB(235, 235, 235) btn.Font = Enum.Font.GothamMedium btn.TextSize = 15 btn.Text = "Get Coords" btn.AutoButtonColor = false btn.BorderSizePixel = 0 btn.Parent = sg local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0, 8) corner.Parent = btn local stroke = Instance.new("UIStroke") stroke.Color = Color3.fromRGB(90, 90, 95) stroke.Thickness = 1 stroke.Parent = btn ------------------------------------------------------------ -- dragging ------------------------------------------------------------ local dragging, dragStart, startPos table.insert(state.conns, btn.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = btn.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end end)) table.insert(state.conns, UIS.InputChanged:Connect(function(input) if not dragging then return end if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then local d = input.Position - dragStart btn.Position = UDim2.new( startPos.X.Scale, startPos.X.Offset + d.X, startPos.Y.Scale, startPos.Y.Offset + d.Y ) end end)) ------------------------------------------------------------ -- press = print once ------------------------------------------------------------ table.insert(state.conns, btn.Activated:Connect(function() local hrp = getHRP() if not hrp then print("[COORDS] No character found.") return end local p = hrp.Position print(string.format("[COORDS] X: %.2f Y: %.2f Z: %.2f", p.X, p.Y, p.Z)) -- brief flash so you can see the press registered btn.BackgroundColor3 = Color3.fromRGB(35, 110, 55) stroke.Color = Color3.fromRGB(70, 200, 110) task.delay(0.15, function() if btn and btn.Parent then btn.BackgroundColor3 = Color3.fromRGB(45, 45, 50) stroke.Color = Color3.fromRGB(90, 90, 95) end end) end)) print("[COORDS] Button loaded - press it to print your position once.")