I want to teleport players with my GUI (It's something like a whitelist) but everytime I teleport them they just get back to their old spot.
local TextBox = script.Parent.Button.teleport
script.Parent.Button.teleport.FocusLost:connect(function(enterPressed)
if enterPressed then
local PlayerToFind = TextBox.Text
local plr1 = game.Players.LocalPlayer.Character
local plr2 = game.Workspace:FindFirstChild(PlayerToFind)
plr2.HumanoidRootPart.CFrame = CFrame.new(-5951.962, -62.35, -4557.551)
TextBox.Text = "WHITELISTED"
wait(1)
TextBox.Text = "Whitelist:"
wait(2)
end
end)

1 comment
it could be because you're executing it through a LocalScript. you should use RemoteEvents to tell the server to teleport the player.