I tried to make a billboard show up above players head when they enter the game. But for some reason it says that "Character" is a nil value. Also another problem i thought of is when the player resets the billboard GUI goes away. Please help!
game.Players.PlayerAdded:connect(function(player) board = Instance.new("BillboardGui",player.Character.Head) board.Active = true board.AlwaysOnTop = true board.Size = UDim2.new(0,10,0,10) end)
When the player joins, their character hasn't loaded yet. Hence, player.Character
is nil
(that's where the error you're getting come from).
If you want something to be done each time the player spawns, you could use the CharacterAdded
event of the player:
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) board = Instance.new("BillboardGui", character.Head) -- You could still use `player.Character.Head`, but just -- `character.Head` is nicer board.Active = true board.AlwaysOnTop = true board.Size = UDim2.new(0, 10, 0, 10) end) end)