Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 10 years ago
01a = script.Votingstatus1.Value
02b = script.Votingstatus2.Value
03c = script.Votingstatus3.Value
04 
05    if a > b and a > c then
06        print "a wins"
07    elseif
08        b > a and b > c then
09        print "b wins"
10    elseif
11        c > a and c > b then
12        print "c wins"
13    elseif
14        print"?" then
15    end

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

Votingstatus1, 2, and 3 is the IntValue

1 answer

Log in to vote
1
Answered by
Voltoxus 248 Moderation Voter
10 years ago

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:

01local a = script.Votingstatus1.Value
02local b = script.Votingstatus2.Value
03local c = script.Votingstatus3.Value
04 
05if a>b and a>c then
06    print "a wins"
07elseif b>a and b>c then
08    print "b wins"
09elseif c>a and c>b then
10    print "c wins"
11else
12    print "?"  
13end
0
Thanks rabidhalofan12345 55 — 10y
0
np Voltoxus 248 — 10y
Ad

Answer this question