I created this script like a month ago, I decided to use it in my game but it's not working. The output gives me this error:

"19:58:10.832 - Workspace.Staff Lanyard:12: 'end' expected (to close 'function' at line 5) near ''"

How do I fix this?

Here is my script:

local lanyard = game:GetService("ServerStorage"):WaitForChild("Lanyard")
GroupId = 4525647
min = 3

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)		
		if player:GetRankInGroup(GroupID) >= min then
			local clonedlanyard = lanyard:Clone()
			clonedlanyard.Parent = game.Workspace:WaitForChild(player.Name)		
		end
		
end)

5 comments

0

You forgot to put an end). Just put one at line 11.

0

Include an additional end) on line eleven to close the function connected to the CharacterAdded event.

0

Okay, thanks. It worked. I really appreciate it.

0

No problem. Now that your question is solved, please put [Solved] in the title of your question, so that people know you no longer need help.

0

Edit: Marked as solved