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

player added works for all player but me?

So I have a script that gives you a billboard gui label for a custom name, problem is, I, the creator of the game can't have a billboard above my head for some reason.. If I test in studio and create a new server there it works, but if I start a server normally outside studio it doesn't work, but for my friend it works. (We can both see his name, but we cant see my name)

here's my code but I doubt it has something to do with it

local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")
game.Players.PlayerAdded:Connect(function(player)
	print('new player')
	player.CharacterAdded:Connect(function(char)
		print('cloned')
		local clonedgui = billboardgui:Clone()
		clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
		clonedgui.TextLabel.Text = player.Name
		print('done')
		--clonedgui.PlayerToHideFrom = player
		--clonedgui.TextLabel.TextColor3 = Color3.fromRGB(231,206,12)
	end)
end)

6 comments

0

Well why did you try hiding it

0

I didn't... that's the problem

0

I didn't... that's the problem

0

I'm confused, what's the script supposed to do?

0

give you a roleplaying name above your head

0

but the text label doesnt appear above my head

2 answers

If this helped then please mark it as answered, I did not try it on studio cuz its kinda late rn and im too lazy ;-; SORRY!! If you have any further question you can just comment.

local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")
game.Players.PlayerAdded:Connect(function(player)
    print('new player')
   local char = player.Character or workspace.ChildAdded:Wait()
        print('cloned')
        local clonedgui = billboardgui:Clone()
        clonedgui.Parent = char.Head --// You did player.Name, player name does not have a head, instead you have to make it 'char'
        clonedgui.TextLabel.Text = player.Name
        print('done')
        --clonedgui.PlayerToHideFrom = player
        --clonedgui.TextLabel.TextColor3 = Color3.fromRGB(231,206,12)
    end)
end)

1 comment

0

and make sure not in a local script.

Found the problem.

clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head

It would find the first model in the workspace with the player name, but I already have a model with my name so I deleted that model and now it works

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