Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Unexpected Symbol near ')' ?

Alright, so In this script I'm getting the error "Unexpected Symbol near ')' " It doesn't tell me where it is, but I only get the error When I put in the For Loop. If someone can help that would be great.

script.Parent.MouseButton1Click:connect(function()
	
for i, child in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
        if child:IsA("Hat") then
          child:Destroy()
        end	

	game.Players.LocalPlayer.Character.Torso.Transparency = 1
	game.Players.LocalPlayer.Character.Head.face:Destroy()
	
char = game.Players.LocalPlayer.Character
char.Head.Transparency = 1

local weld = Instance.new("Weld") 
weld.Parent = char.Head
weld.Part0 = char.Head
weld.Part1 = game.Lighting.Part:Clone()
weld.Part1.Parent = char
weld.C0 = CFrame.new(0, 0, 0)
	
	game.Players.LocalPlayer.Character["Left Arm"].Transparency = 1
	game.Players.LocalPlayer.Character["Right Arm"].Transparency = 1
	game.Players.LocalPlayer.Character["Left Leg"].Transparency = 1
	game.Players.LocalPlayer.Character["Right Leg"].Transparency = 1
end)

2 answers

✓ Accepted answer

First of all, the for loop, you forgot to end it. You need to put another end in it. I fixed it for you here:

script.Parent.MouseButton1Click:connect(function()
	for i, child in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
	        if child:IsA("Hat") then
	          child:Destroy()
		end
	end
	game.Players.LocalPlayer.Character.Torso.Transparency = 1
	game.Players.LocalPlayer.Character.Head.face:Destroy()
	char = game.Players.LocalPlayer.Character
	char.Head.Transparency = 1
	local weld = Instance.new("Weld")
	weld.Parent = char.Head
	weld.Part0 = char.Head
	weld.Part1 = game.Lighting.Part:Clone()
	weld.Part1.Parent = char
	weld.C0 = CFrame.new(0, 0, 0)game.Players.LocalPlayer.Character["Left Arm"].Transparency = 1
	game.Players.LocalPlayer.Character["Right Arm"].Transparency = 1
	game.Players.LocalPlayer.Character["Left Leg"].Transparency = 1
	game.Players.LocalPlayer.Character["Right Leg"].Transparency = 1
end)

You don't end the for loop, so when you do, it does it with end), but it wants you to also end the function you created on the first line before you have your ).

This is as simple as adding end before the last line.

This discussion is preserved as it was. New answers, comments, and votes are closed.