How can I teleport a player to another player and selecting the player to be teleported to by using a textbox?
Use LostFocus
For the event. As this activates when the player has left the text box.
use game.Workspace:FindFirstChild(TextBox Text
)
and game.LocalPlayer.Character.Torso.CFrame = Chosen Player Torso CFrame
I recommend you use the FocusLost
event in a local script, The FocusLost
event fires every time the TextBox
loses focus (by the enter button being pressed). Make sure the event searches in the Players service for the player with the name of the text in the TextBox
and sets the CFrame of the your character's torso to the player with their name in the TextBox
.
Player1.Character.Torso.CFrame = Player2.Character.Torso.CFrame * CFrame.new(0, 5, 0)