I am making a game where a payer needs to pick a colour and try to eliminate all the other players. I want to make it so that when the Players team has no players left the round will end. I am a new scripter and I cant find anything online, I appreciate any help!
This is my script:
while true do
wait(10)
function setTeam(player, teamName)
player.TeamColor = game.Teams[teamName].TeamColor
if player.Character then --Just in case the character doesn't exist for some reason
player:LoadCharacter() -- Kills the players' character
end
end
– Change Teams
for _, player in pairs(game.Players:GetPlayers()) do
setTeam(player, “Players”)
end
– ColourPicker
local Players = game.Players
local Picker = game.Teams.ColourPicker
wait(.5)
plrs = game.Players
local p = plrs:GetPlayers()
local selected_value = math.random(1, #p)
p[selected_value].Team = game.Teams.ColourPicker
p[selected_value]:LoadCharacter()
– end if players die
if game.Teams.ColourPicker:GetPlayers()
– This is where I want it to happen.
– Change Back
wait(180)
function setTeam(player, teamName)
player.TeamColor = game.Teams[teamName].TeamColor
if player.Character then --Just in case the character doesn't exist for some reason
player:LoadCharacter() -- Kills the players' character
end
end
– Change Teams
for _, player in pairs(game.Players:GetPlayers()) do
setTeam(player, “Lobby”)
end
end
If anybody could help me out I would appreciate it!