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

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

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

2 comments

0

the equality operator is two "="s, not 1

0

kthx

2 answers

✓ Accepted answer

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.

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

1 comment

0

and the all

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