I’m trying to make a teleport system that only teleports one player from a team to a part but every time I test it, the output says “Script Timeout: exhausted allowed execution timeout.” How would I fix that?
Script:
local teleblock = workspace.TeleportTest -- Part Player is Teleporting To
wait(15)
while true do
local team = game:GetService("Teams"):WaitForChild("Awaiting Witch"):GetPlayers()
if #team ~= 0 then
local playerpicked = math.random(1, #team)
for i, v in pairs(team) do
if i == playerpicked then
v.Character:SetPrimaryPartCFrame(teleblock.CFrame + Vector3.new(0, 4, 0))
print("Teleport Done")
end
end
end
end