Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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)

5 comments

1

PlayerAdded is an RBXScriptSignal of the Players Service: game:GetService("Players").PlayerAdded.

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?

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?

0

You have to set the GUI object's adornee property to the player's you want the GUI to be head

0

i want the gui to be on all players

1 answer

✓ Accepted answer
--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.

1 comment

0

Thanks! <3

This discussion is preserved as it was. New answers, comments, and votes are closed.