local plr = game.Players.LocalPlayer local plrlist = game.Players:GetChildren() local placeid = 2962165468 game.Workspace.KingCrab.Humanoid.Died:Connect(function() wait(5) for i = 1,#plrlist do game:GetService("TeleportService"):Teleport(placeid, plr[plrlist]) end end)
Not works what do i need to do
You can't teleport other players with a LocalScript
. You need to use a server script to do that.
Btw use Players:GetPlayers()
instead of Players:GetChildren()
`workspace.KingCrab.Humanoid.Died:Connect(function() wait(5) for i,v in pairs(game.Players:GetPlayers()) do game:GetService("TeleportService"):Teleport(v, 2962165468) end end)
First of all you do not use a local script to teleport people as that will not work as TeleportService can only be called on the server and not the client.
Second of all i suggest using pairs when iterating through a table personally.
But i will happily write an example for you to follow.
This needs to be put into a server script: ```
local PlaceId = nil -- Change this to a place if of your choice local Players = game.Players:GetPlayers() local TeleportService = game:GetService("TeleportService")
for I,Players in pairs(Players) do TeleportService:Teleport(PlaceId,v) end