Hello, I am creating a battle royale game, but my lobby party teleport system isn't functioning! There's no error statements in the OutPut, and as far as I can see, nothing wrong with the script itself! It's placed in a LOCALSCRIPT inside the teleport part. Please help!
local Part = script.Parent script.Parent.Touched:Connect(function(hit) local tableOfParts = Part:GetTouchingParts() local numberOfPlayers = 0 for i,v in pairs(tableOfParts) do if v:FindFirstChild("Humanoid") then numberOfPlayers = numberOfPlayers + 1 end end if numberOfPlayers == 2 then for i,v in pairs(tableOfParts) do if v:FindFirstChild("Humanoid") then local plr game:GetService("Players"):GetPlayerFromCharacter(v) game:GetService("TeleportService"):Teleport(2978237413,plr) end end end end)
1) Please indent. 2) I'm assuming that localscript is in workspace, so simpy change that client-sided script into a server-sided scripted which will solve all your problems 3) TeleportService is known for having the most failed connections, so I'm suggesting you pcall the teleporting part and probably kick the player if it can't successfuly teleport the player.