I have this script where every 60 seconds the player will change teams randomly. i put the script in workspace and it isnt working! so can someone please help me with this?
this is the code:
local player = game.Players.LocalPlayer local TeamValue = 0 while true do wait(60) TeamValue = math.random(1, 2) if TeamValue == 1 then player.Team = "Red Team" end if TeamValue == 2 then player.Team = "Blue Team" end end
--// Variables local Teams = game.Teams:GetChildren() while wait(60) do for i,v in pairs(game.Players:GetPlayers()) do local RandomTeam = Teams[math.random(1, #Teams)] v.Team = RandomTeam end end