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

why error end expected to close?

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!

4 comments

0

You forgot to close the if statement. Add an end above end)

0

OP manually removed the end LOL

0

This is where indenting becomes really handy.

1 answer

✓ Accepted answer
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)

2 comments

0

Thanks! Won't forget this next time.

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