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

why error end expected to close?

Asked by 6 years ago

I wanted to make a script so if my avatar loaded, my HeadScale would be changed to 4. However, studio responded with an error. Here is the script:

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(char)
        if player.Name == "YT_Epiix" then
        local user = game.Workspace:WaitForChild("YT_Epiix")
        user.Humanoid.HeadScale.Value = 4
    end)
end)

If you could teach me how to fix this error, I would appreciate it. Thanks!

0
You forgot to close the `if` statement. Add an `end` above `end)` Zafirua 1348 — 6y
0
OP manually removed the end LOL User#19524 175 — 6y
0
This is where indenting becomes really handy. User#21908 42 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago
game.Players.PlayerAdded:Connect(function(player)
        player.CharacterAdded:Connect(function(char)
            if player.Name == "YT_Epiix" then -- if statements need an end to close them
            local user = game.Workspace:WaitForChild("YT_Epiix")
            user.Humanoid.HeadScale.Value = 4
end-- heres the end you need to add
        end)
    end)
0
Thanks! Won't forget this next time. ElusiveEpix 2 — 6y
Ad

Answer this question