Answered by
4 years ago Edited 4 years ago
Hello DataCardz!
There are a few issues with your script, here I'll go over each one and what I'd do.
1 | local players = game.Players:GetChildren() |
ROBLOX has a specific function to get players, rather than having to do GetChildren() of the players. You could do what's listed below instead.
1 | local players = game:GetService( 'Players' ):GetPlayers() |
Moving onto line 04.
1 | game.Workspace.Triggers.CabinTrigger:Destroy() |
This script will try to run before Triggers, or CabinTrigger is loaded in. You should use :WaitForChild() just to be safe. Refer to the link for a better explanation on :WaitForChild().
Next up,
1 | players [ i ] .Character:MoveTo(game.Workspace.TeleportPoints.CabinTeleport 1. Position) |
Again, you should be using a WaitForChild() to make the script wait for CabinTeleport1. However, from the looks of it, you're destroying CabinTrigger before teleporting the player. Additionally, :MoveTo() you can not use :MoveTo() on the players character model itself. You're going to have to get the Players character humanoid and use :MoveTo().
1 | players [ i ] .Character:WaitForChild( 'Humanoid' ):MoveTo(game.Workspace.TeleportPoints.CabinTeleport 1. Position) |
If this still does not work you need to ensure that:
A) CabinTeleport1 is not nil / is inside of the TeleportPoints folder.
B) This is a server script
C) This script is inside somewhere the server access / run