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

Why does the '=' have a syntax error saying "Expected then when parsing if statment. got '='?

Asked by 4 years ago

Why does the '=' have a syntax error saying "Expected then when parsing if statment. got '='? code:

if workspace.Timer.Value => 0 then
function leftClick()
    workspace.Classic.Value = workspace.Classic.Value + 1
    script.Disabled = true
end
script.Parent.MouseButton1Click:Connect(leftClick)

im fairly new to coding

0
Add an extra end. You didn't add one. Dovydas1118 1495 — 4y

2 answers

Log in to vote
2
Answered by 4 years ago
Edited 4 years ago

The if statement at the start of your code has no actual end. The only end you're using is ending the function inside(?) of the statement, not the statement itself. You'll need to insert an end either before the function and after the statement is defined (anywhere after the if but before the start of the function) or after the function to alleviate the issue.

Also, all conditional syntax use either >, <, or x= for number comparison, where x is either =, ~, >, or <. => is incorrect syntax.

0
thanks but sadly i cant accept both Radiant_Sparkles 69 — 4y
0
ill upvote it AlexanderYar 788 — 4y
Ad
Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

in line one the symbol is =>, thats wrong i think, im pretty sure its >=

Edit: Yup i tested and got the same error, its the greater sign first then equal sign last

0
hope this works :3 AlexanderYar 788 — 4y
0
also yeah your missing an end it seems AlexanderYar 788 — 4y
0
Yea thanks, someone else gave me this answer too and it worked, but he didnt answer sio welp might as well accept yours Radiant_Sparkles 69 — 4y

Answer this question