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

PlayerAdded is not a valid member of DataModel. can someone help?

Asked by 3 years ago

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

local rank = game:GetService("ReplicatedStorage").BillboardGui

game.PlayerAdded:Connect(function(plr)
    repeat wait() until plr.CharacterAdded
    local c = rank:Clone()
    c.OverheadText.Text = "Adventurer"
    c.Parent = workspace:FindFirstChild(plr.Name).Head
end)
1
PlayerAdded is an RBXScriptSignal of the Players Service: game:GetService("Players").PlayerAdded. Ziffixture 6913 — 3y
0
it kinda works now, but the overhead gui shows on a character i inserted through the MoonAnimator plugin, is there anything i could do? YandH015 9 — 3y
0
ummm that must be a bug bcs its getting the service of players and then saying when a players added run your script so unless the character you inserted is in Players then im not sure it might be bcs of repeat wait() until plr.CharacterAdded that might be bugged and literally getting every single character in the game? Mrpolarbear2games 55 — 3y
0
You have to set the GUI object's adornee property to the player's you want the GUI to be head marijus06 68 — 3y
0
i want the gui to be on all players YandH015 9 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
--Inside a server script

local rank = game.ReplicatedStorage:FindFirstChild("BillboardGui") -- Define BBGui
game.Players.PlayerAdded:Connect(function(player) -- PlayerAdded is an RBXScriptSignal called from game.Players. game.PlayerAdded isn't correct.
    player.CharacterAdded:Connect(function(character) -- Wait for players character so the gui will be inserted back after they die
        if rank ~= nil then
            local c = rank:Clone()
            c.Parent = character.Head
            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.
        end
    end)
end)
--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.
0
Thanks! <3 YandH015 9 — 3y
Ad

Answer this question