local replicatedstorage = game:GetService("ReplicatedStorage") local status = replicatedstorage:WaitForChild("StatusValue") local meat = game.Players.LocalPlayer while true do for i = 10,0,-1 do status.Value = "Intermission:"..i wait(1) end game.Players.LocalPlayer.TeamColor = BrickColor.new("Really red") game.Players.LocalPlayer:LoadCharacter() game.Players.LocalPlayer.TeamColor = BrickColor.new("Really red") for i = 120,0,-1 do status.Value = "Game In Progress:"..i wait(1) end game.Players.LocalPlayer.TeamColor = BrickColor.new("White") game.Players.LocalPlayer:LoadCharacter() game.Players.LocalPlayer.TeamColor = BrickColor.new("White") end
So, this code controls the round times and teleporting players away from and to the map. The Red team is in the game, and the white team is in the lobby. When it changes the players team, it resets them afterwards, basically teleoprting them to a diffrent spawn point.
The problem here is that This is the the serverscriptservice and in a normal script. How can i acheive something similar to .Localplayer in a non-local script?
Loop through each player in the game and run the code on each of them like so:
local replicatedstorage = game:GetService("ReplicatedStorage") local status = replicatedstorage:WaitForChild("StatusValue") while true do for i = 10,0,-1 do status.Value = "Intermission:"..i wait(1) end for _,plr in pairs(game.Players:GetPlayers()) do plr.TeamColor = BrickColor.new("Really red") plr:LoadCharacter() end for i = 120,0,-1 do status.Value = "Game In Progress:"..i wait(1) end for _,plr in pairs(game.Players:GetPlayers()) do plr.TeamColor = BrickColor.new("White") plr:LoadCharacter() end end
If this works for you, please accept it as the answer and vote up if you feel like it. If this doesn't work or doesn't do what you wanted it to do, let me know down below in the comments with as much detail as possible.