I want it so when there is one player left, the game rewards the player with a win.
Code:
for i,v in pairs(game.Players:GetPlayers()) do
v:WaitForChild("Alive").Value = true
repeat
wait(1)
StartRound()
until game.Workspace.PlayersAlive.Value == 1
for i,v in pairs (game.Players:GetPlayers()) do
if v.Alive == true then
changeColourText(v.." has won the game!")
v.leaderstats.Wins.Value = v.leaderstats.Wins.Value + 1
v.Alive = false
[Disclaimer: I know its obviously not going to work I have only been scripting for about a month but I have been a gfx artist for way longer than that.]
local function StartRound()
wait()
local randomColour = game.Workspace.Colours:GetChildren()[math.random(1, 6)]
print (randomColour)
changeColour(randomColour)
Countdown()
local colours = game.Workspace.Colours:GetChildren()
for i,v in pairs (colours) do
v.Parent = game.ReplicatedStorage
randomColour.Parent = workspace.Colours
end
wait(3)
for i,v in pairs (colours) do
v.Parent = workspace.Colours
end
end
Countdown():
local function Countdown()
changeCountdown(“5”)
wait(1)
changeCountdown(“4”)
wait(1)
changeCountdown(“3”)
wait(1)
changeCountdown(“2”)
wait(1)
changeCountdown(“1”)
wait(1)
changeCountdown(“GO!”)