I have made a script that is supposed to delete the player's face upon joining:
game.Players.PlayerAdded:connect(function(pl) pl.Character:connect(function(c) repeat wait() until c:FindFirstChild('Head') c.Head.face:Destroy() end) end)
However, when I go into play mode in Roblox studio, no changes are made to the player's character, and I get this error in the output:
09:30:03.798 - ServerScriptService.Script:2: attempt to index field 'Character' (a nil value)
I also tested this in an online server, and nothing is done to the player's character.
Is there a different way to get the player's character?
You were so close! The event name is CharacterAdded
. It seems you understand the meaning of it already.
game.Players.PlayerAdded:connect(function(pl) pl.CharacterAdded:connect(function(c) repeat wait() until c:FindFirstChild('Head') -- Not needed, since it is there once the Character is added c.Head.face:Destroy() end) end)