I need to teleport someone upon entering, about 3 seconds after they join. I tried
1 | function onPlayerEntered(player) |
2 | wait( 3 ) |
3 | game.Workspace.Player.Torso.Position = Vector 3. new( 0 , 50 , 0 ) |
4 |
5 | end |
Didn't do anything. I am using a spawn part if that is useful.
Thanks,
CallKnuss
A simple fix to your problem would be to move the Humanoid Root by CFraming. This eliminates the outcome of killing the player. Also you need to connect the function, and list variables to gather information on what the HumanoidRootPart is.
Heres the script!
1 | local player = game.Players.LocalPlayer --Identifies the Player |
2 | local character = player.CharacterAdded:wait() --Indentifies the character by waiting for for the character to be added into "player" |
3 | local root = character:WaitForChild( 'HumanoidRootPart' ) --Indentifies the HumanoidRootPart |
4 |
5 | function onPlayerEntered() --Names the Function |
6 | wait( 3 ) --Waits 3 seconds |
7 | root.CFrame = CFrame.new(Vector 3. new( 0 , 50 , 0 )) -- Sets CFrame of the HumanoidRootPart to the location of where you want to be teleported |
8 | end |
9 | game.Players.PlayerAdded:connect(onPlayerEntered()) --Connects the function |
I hope this helped, please comment if you have any questions or concerns!