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

Why am I getting errors???? I’ve been asking for ours and hours, please help!

Asked by 2 years ago
Edited 2 years ago
  • I was too lazy to type all the variables and stuff*
while game.Workspace.CoreOnline == “1” do
wait(2)
tempVal.Value = if CoolT == 1 then
    tempVal.Value - 10
     end 
end *error* 

1 answer

Log in to vote
0
Answered by 2 years ago

You cannot directly use an if statement to check for a condition while declaring a variable or setting a property of something. Instead you could this way to check for a condition:

while game.Workspace.CoreOnline == “1” do
wait(2)
tempVal.Value -= (CoolT == 1 and 10) or 0  
end *error*

So basically this "(CoolT == 1)" returns either true or false and if its true, it proceeds to removing 10 from its value, otherwise, the "or" just tells it to do the other if the one before is not true which in this case would be when "CoolT" does not equal to one.

I hope i helped. Tell me if there's something you dont understand.

0
Thank you. LeoPlaysGames_RBX 26 — 2y
0
I found another way to get around this as well. LeoPlaysGames_RBX 26 — 2y
Ad

Answer this question