So I have made a script that makes a GUI that can teleport a player to another. But when someone has a different screen size than me. The GUI button and guitextbutton move from each other. Can anyone fix?
local loc = game.Players.LocalPlayer.PlayerGui local screengui = Instance.new("ScreenGui", game.StarterGui) local frame = Instance.new("Frame", game.StarterGui.ScreenGui) local textbox1 = Instance.new("TextBox", game.StarterGui.ScreenGui.Frame) local textbox2 = Instance.new("TextBox", game.StarterGui.ScreenGui.Frame) local textbutton = Instance.new("TextButton", game.StarterGui.ScreenGui.Frame) frame.Size = UDim2.new(0, 252,0, 121) textbox1.Size = UDim2.new(0, 252,0, 94) textbox2.Size = UDim2.new(0, 252,0, 94) textbutton.Size = UDim2.new(0, 252,0, 70) screengui.Parent = loc frame.Parent = loc.ScreenGui textbox1.Parent = loc.ScreenGui textbox2.Parent = loc.ScreenGui textbutton.Parent = loc.ScreenGui textbox2.Position = UDim2.new(0, 0,0.124, 0) textbutton.Position = UDim2.new(0, 0,0.248, 0) frame.BackgroundColor3 = Color3.new(255, 255, 255) textbox1.BackgroundColor3 = Color3.new(255, 255, 255) textbox2.BackgroundColor3 = Color3.new(255, 255, 255) textbutton.BackgroundColor3 = Color3.new(255, 255, 255) textbox1.Text = ("Player1") textbox2.Text = ("Player2") textbutton.MouseButton1Click:Connect(function(tel) local txtboxtext = textbox2.Text local player = textbox1.Text local playerhun = game.Workspace:FindFirstChild(player) local player2 = game.Workspace:FindFirstChild(txtboxtext) local player2pos = player2.HumanoidRootPart.Position print(player2pos) playerhun:MoveTo(player2pos) end)
Hello, well i don't really know how to fix that problem but it probably has to do with the position offsets, etc