Ad
Log in to vote
1

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

Asked by 3 months 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 1438 — 3mo

2 answers

Log in to vote
2
Answered by 3 months ago
Edited 3 months 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 — 3mo
0
ill upvote it AlexanderYar 465 — 3mo
Ad
Log in to vote
1
Answered by 3 months ago
Edited 3 months 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 465 — 3mo
0
also yeah your missing an end it seems AlexanderYar 465 — 3mo
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 — 3mo

Answer this question