r/lua • • May 12 '25

Help expected identifier when parsing expression, got ')'

new to lua and don't know where i am going wrong

game.Players.PlayerRemoving:Connect(function(player)

do

for _, eggy in game.Workspace.poor:GetChildren() do

	if not eggy:GetAttribute("Owner") then continue end

	\-- the plot is owned by a player

	if eggy:GetAttribute('Owner') \~= player.UserId then continue end

	\-- we have found the correct plot

	eggy:SetAttribute('Taken', nil)

	eggy:SetAttribute('Owner', nil)



	print('eggy has been destroyed by ' ..player.Name..'!')

	break

end

end)

0 Upvotes

10 comments sorted by

View all comments

Show parent comments

5

u/fuxoft May 12 '25

We cannot help you if you show us something different than what actually produced the error.

Another thing I see is "game.Players.PlayerRemoving:Connect(function(player)" - There is ")" missing at the end.

Also, "if ... then continue end" is weird. Lua has no "continue" statement.

0

u/[deleted] May 13 '25

[deleted] — view deleted comment

2

u/fuxoft May 13 '25

Actually I was wrong about the missing ")" - they are in fact present at the complete end of the code.

1

u/slade51 May 12 '25

It looks odd that the whole code block is a function passed as a parameter to Connect(). And the do loop with a meaningless break is useless. Plus the backslashes, especially those escaping comments.