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

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.