Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local character = player.Character or player.CharacterAdded:Wait()
- local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
- -- GUI setup
- local screenGui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))
- screenGui.Name = "MobileCoordsGUI"
- screenGui.ResetOnSpawn = false
- -- Get Coordinates Button
- local getButton = Instance.new("TextButton")
- getButton.Size = UDim2.new(0, 200, 0, 50)
- getButton.Position = UDim2.new(0.5, -100, 0.3, 0)
- getButton.Text = "Get Coordinates"
- getButton.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
- getButton.TextColor3 = Color3.new(1, 1, 1)
- getButton.Font = Enum.Font.SourceSansBold
- getButton.TextScaled = true
- getButton.Parent = screenGui
- -- Coordinates TextBox
- local coordBox = Instance.new("TextBox")
- coordBox.Size = UDim2.new(0, 300, 0, 50)
- coordBox.Position = UDim2.new(0.5, -150, 0.4, 0)
- coordBox.Text = "X: 0, Y: 0, Z: 0"
- coordBox.ClearTextOnFocus = false
- coordBox.TextEditable = false
- coordBox.Font = Enum.Font.SourceSans
- coordBox.TextScaled = true
- coordBox.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- coordBox.TextColor3 = Color3.new(0, 0, 0)
- coordBox.Parent = screenGui
- -- Copy Button
- local copyButton = Instance.new("TextButton")
- copyButton.Size = UDim2.new(0, 200, 0, 50)
- copyButton.Position = UDim2.new(0.5, -100, 0.5, 0)
- copyButton.Text = "Copy"
- copyButton.BackgroundColor3 = Color3.fromRGB(0, 200, 100)
- copyButton.TextColor3 = Color3.new(1, 1, 1)
- copyButton.Font = Enum.Font.SourceSansBold
- copyButton.TextScaled = true
- copyButton.Parent = screenGui
- -- Function to get position
- local function updateCoords()
- local char = player.Character or player.CharacterAdded:Wait()
- local hrp = char:WaitForChild("HumanoidRootPart", 2)
- if hrp then
- local pos = hrp.Position
- coordBox.Text = string.format("X: %.2f, Y: %.2f, Z: %.2f", pos.X, pos.Y, pos.Z)
- end
- end
- -- Button events
- getButton.MouseButton1Click:Connect(updateCoords)
- copyButton.MouseButton1Click:Connect(function()
- if setclipboard then
- setclipboard(coordBox.Text)
- else
- coordBox.Text = "Copy not supported here"
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement