I have tried countless times to fix this one function; and it just doesn’t want to work. After they are teleported, if I try to move one client, it doesn’t update on the other client. And even when it does update for both clients, the round won’t start back up again. It says the player that died is missing from the table.
PLEASE HELP ME
here is the script:
function NewRound(Player,Status,w)
if table.find(PlayersTable,Player.Name) then
Player = table.find(PlayersTable,Player.Name)
if Player then
if w:IsA("Part") then
RedTeleportParts = ORedTeleportParts
BlueTeleportParts = OBlueTeleportParts
if BlueNumber <= RedNumber then
if BlueNumber < MaxPlayers then
w.CFrame = BlueTeleportParts[1].CFrame
table.remove(BlueTeleportParts,1)
end
else
if RedNumber < MaxPlayers then
w.CFrame = RedTeleportParts[1].CFrame
table.remove(RedTeleportParts,1)
end
end
Player.Character.Humanoid.WalkSpeed = 0
Status.Value = "Get ready to fight!"
wait(3)
for i=3,1,-1 do
Status.Value = "Round starting in "..i
wait(1)
end
--GAME HAS SUCCESSFULLY STARTED!
GameInProgress = true
local Sword = game.ServerStorage.Swords.ClassicSword:Clone()
Sword.Parent = Player.Backpack
Player.Character.Humanoid.WalkSpeed = 16
Status.Value = "Last team standing earns a point!"
repeat wait() until BlueNumber == 0 or RedNumber == 0
--Round has ended.
Status.Value = "Round ended!"
Sword:Destroy()
wait(5)
if BlueNumber == 0 then
RedPoints += 1
elseif RedNumber == 0 then
BluePoints += 1
end
if RedNumber ~= PointsToWin and BlueNumber ~= PointsToWin then
NewRound()
end
end
else
warn("Player is nil!")
end
end
end