so i was making an overhead GUI script and it says that PlayerAdded isnt a valid member of datamodel. can someone help? here is the code
1 | local rank = game:GetService( "ReplicatedStorage" ).BillboardGui |
2 |
3 | game.PlayerAdded:Connect( function (plr) |
4 | repeat wait() until plr.CharacterAdded |
5 | local c = rank:Clone() |
6 | c.OverheadText.Text = "Adventurer" |
7 | c.Parent = workspace:FindFirstChild(plr.Name).Head |
8 | end ) |
01 | --Inside a server script |
02 |
03 | local rank = game.ReplicatedStorage:FindFirstChild( "BillboardGui" ) -- Define BBGui |
04 | game.Players.PlayerAdded:Connect( function (player) -- PlayerAdded is an RBXScriptSignal called from game.Players. game.PlayerAdded isn't correct. |
05 | player.CharacterAdded:Connect( function (character) -- Wait for players character so the gui will be inserted back after they die |
06 | if rank ~ = nil then |
07 | local c = rank:Clone() |
08 | c.Parent = character.Head |
09 | c.Adornee = character.Head -- You must set the adornee of a BillBoardGui. Adornee is what part the Gui is displayed on. You can parent the gui in workspace and adornee it to a players head and it will still work. |
10 | end |
11 | end ) |
12 | end ) |
13 | --This will get every player that joins the server, waits for each time the players character spawns, and then creates a new gui for that players head. |