Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

[Solved]Why wont this piece of code detect the IntValue using variables?

a = script.Votingstatus1.Value
b = script.Votingstatus2.Value
c = script.Votingstatus3.Value

	if a > b and a > c then
		print "a wins"
	elseif
		b > a and b > c then
		print "b wins"
	elseif
		c > a and c > b then
		print "c wins"
	elseif
		print"?" then
	end

The piece of code won't detect the value of the IntValue

Votingstatus1, 2, and 3 is the IntValue

1 answer

✓ Accepted answer

Well one problem I see would be you putting the comparison statement under the "elseif" instead of on the same line, and the "then" should also be on the same line.

Another problem I see is the last "elseif" should be else.

Here the corrected code:

local a = script.Votingstatus1.Value
local b = script.Votingstatus2.Value
local c = script.Votingstatus3.Value

if a>b and a>c then
	print "a wins"
elseif b>a and b>c then
	print "b wins"
elseif c>a and c>b then
	print "c wins"
else
	print "?"	
end

2 comments

0

Thanks

0

np

This discussion is preserved as it was. New answers, comments, and votes are closed.