Greater than not working as intended

Hi, I’m making a football game. In this script I determine the winner by points/goals.

local red = game.Workspace.RedPoints.Value
local blue = game.Workspace.BluePoints.Value

local redwin = blue < red
local bluewin = blue > red

wait(30)

if redwin ==
	true then
	print("Red wins, success")
end

if bluewin == true then
	print("Blue won! Success")
end

But when Blue is 3 and red is 2 it doesn’t give an answer after 30 seconds.

Also when I use (blue > red) it just says false while blue is greater than red

Hello,

You’re storing the result before the game ends, all you have to do is put redwins and bluewins variables below the wait(), and you’re also storing the red and blue values too at the variables at the start

local red = game.Workspace.RedPoints
local blue = game.Workspace.BluePoints

task.wait(30)

local redwin = blue.Value < red.Value
local bluewin = blue.Value > red.Value

if redwin ==
	true then
	print("Red wins, success")
end

if bluewin == true then
	print("Blue won! Success")
end

Also use task.wait() its way more efficient and accurate

It works, and a tie I do like this?:

local tie = blue.Value == red.value

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.