Anyway I can make it so you can win?

Im having trouble making it so you can win.

Game: (ik its basic atm)


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.]

1 Like

Can you show the entire script, ie, the start round function?

1 Like

Okay let me open up studio. Give me a sec.

1 Like

StartRound():

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!”)

end

1 Like

Oops why is some of it in… Bruh lemme fix that.

Ignore that, I cant fix it lol.

1 Like