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

Why does my script keep having errors saying "then" expected near "="?

Asked by 4 years ago

The script below has an error saying ("then" expected near "="). If I put a "then" there, it gives me another error saying that the "then" was unexpected. There are no errors regarding the existence of anything in the script, just the error I mentioned.

while true do
    if Game.Workspace.Increase.Increase.Value = 1
    then script.Parent.Value = script.Parent.Value + 1
    if Game.Workspace.Decrease.Decrease.Value = 1
    then script.Parent.Value = script.Parent.Value + 1
        wait(2)


    script.Parent.Value
end

0
the equality operator is two "="s, not 1 theking48989987 2147 — 4y
0
kthx billybobRAE 41 — 4y

2 answers

Log in to vote
0
Answered by
asadefa 55
4 years ago
Edited 4 years ago

This code should fix your problem. Also please do not start "then" on a new line it made me really confused

while true do
    if Game.Workspace.Increase.Increase.Value = 1
    then script.Parent.Value = script.Parent.Value + 1
    if Game.Workspace.Decrease.Decrease.Value == 1 then
    script.Parent.Value = script.Parent.Value + 1
        wait(2)


    script.Parent.Value
end

Hope this helped.

Ad
Log in to vote
0
Answered by
gloveshun 119
4 years ago
Edited 4 years ago

the right script:

while wait(2) do
    if game.Workspace.Increase.Increase.Value == 1 then
    script.Parent.Value = script.Parent.Value + 1
    end
    if game.Workspace.Decrease.Decrease.Value == 1 then
    script.Parent.Value = script.Parent.Value + 1
end
end
0
and the all gloveshun 119 — 4y

Answer this question