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

How do i fix player is not a valid member of Workspace?

local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")
game.Players.PlayerAdded:Connect(function(player)
	if player.Name == "ItzSulfonic" then
		local clonedgui = billboardgui:Clone()
		clonedgui.Parent = game.Workspace[player.Name].Head
		clonedgui.TextLabel.Text = "Owner"
		clonedgui.TextLabel.TextColor3 = Color3.fromRGB(231, 206, 12)
	end
end)

Im trying to make it so ingame i have the word "Owner" above my head only but when i go to test i get this error

16:10:54.665 - ItzSulfonic is not a valid member of Workspace "Workspace"

1 answer

✓ Accepted answer

Try:

local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")
game.Players.PlayerAdded:Connect(function(player)
	if player.Name == "ItzSulfonic" then
		local clonedgui = billboardgui:Clone()
		local you = game.Workspace:WaitForChild("ItzSulfonic") 
		clonedgui.Parent = you.Head
		clonedgui.TextLabel.Text = "Owner"
		clonedgui.TextLabel.TextColor3 = Color3.fromRGB(231, 206, 12)
	end
end)

2 comments

0

Yes this worked perfectly only thing is there's this in output but other than that thanks for the help 18:48:58.302 - Infinite yield possible on 'Workspace:WaitForChild("ItzSulfonic")'

0

Since you are using WaitForChild, if the waitforchild doesn't find what it's waiting for, for the first 5 seconds, the output will display a Infinitie Yield warning, nothing to worry about if your script ends up finding what it's waiting for.

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