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

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

  • 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

✓ Accepted answer

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.

2 comments

0

Thank you.

0

I found another way to get around this as well.

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