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

Weird Outputs Please Help?

Asked by 10 years ago

Output 06:25:28.242 - Workspace.Script:2: attempt to index field 'Character' (a nil value)

game.Players.PlayerAdded:connect(function(p)
    p.Character.Head.BrickColor = BrickColor.new("Bright red")
end)

Happens to all my scripts

1 answer

Log in to vote
2
Answered by 10 years ago

The function you are using is for when a player first joins the game. The Character would not have spawned yet, he/or she would still be loading. Anyhow you should also look at the Wiki.Roblox.Com/ I'm pretty sure they have the info t fix your problem.

But anyhow I will help.

--Server Sided Script

game.Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function(Character)
Character.Head.BrickColor =  BrickColor.new("Bright red")
end)
end)
Ad

Answer this question