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

Unexpected Symbol near ')' ?

Asked by 10 years ago

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

Log in to vote
1
Answered by
Kratos232 105
10 years ago

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)
Ad
Log in to vote
4
Answered by
User#2 0
10 years ago

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.

Answer this question