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

Error "Expected identifier when parsing expression, got ')' ", why?

Asked by 3 years ago
Edited 3 years ago

Hello. I am creating a game and while doing some scripts i had this error: Expected identifier when parsing expression, got ')'. I don't know why it happend and I would love some help from you guys. Thanks in advice.

CODE:

script.Parent.Touched:Connect(function(hit)
    if game.StarterGui.Eggs.Egg1.Visible == true then
    game.StarterGui.Eggs.Egg1.Visible = false
end)

END OF THE CODE, ERRORS:

(

(Error says it's last line, 'end)'.)

(After deleting ')' at 'end)' it says: "Expected 'end' (to close 'function' at line 1), got <eof>; did you forget to close the 'then' at line 2? ")

Problem got solved, but I don't know how to mark correct answer as good answer.

1 answer

Log in to vote
0
Answered by
Leamir 3138 Moderation Voter Community Moderator
3 years ago
Edited 3 years ago

You forgot to close the if with an end

script.Parent.Touched:Connect(function(hit)
    if game.StarterGui.Eggs.Egg1.Visible == true then
    game.StarterGui.Eggs.Egg1.Visible = false     
    end
end)

If this works, please mark this answer as accepted

0
@Leamir you helped me, but I don't know how to mark answer as accepted, this is my first scriptinghelpers questoin. ErktikyYT 89 — 3y
0
Right under the comments section, should have a "Accept Answer" button Leamir 3138 — 3y
0
@Leamir Still I can't find it... ErktikyYT 89 — 3y
0
https://prnt.sc/ttfx5a << screenshot of the button (on the answer coment section) Leamir 3138 — 3y
View all comments (2 more)
0
@Leamir Yeah I don't have it. Probably reputation required or something like that. ErktikyYT 89 — 3y
0
Screenshot of the website that I see https://prnt.sc/ttfzoq ErktikyYT 89 — 3y
Ad

Answer this question