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

player added works for all player but me?

Asked by 4 years ago

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)
0
Well why did you try hiding it programmerHere 371 — 4y
0
I didn't... that's the problem UNBANhappyniceguy5 52 — 4y
0
I didn't... that's the problem UNBANhappyniceguy5 52 — 4y
0
I'm confused, what's the script supposed to do? 0msh 333 — 4y
View all comments (2 more)
0
give you a roleplaying name above your head UNBANhappyniceguy5 52 — 4y
0
but the text label doesnt appear above my head UNBANhappyniceguy5 52 — 4y

2 answers

Log in to vote
0
Answered by
Gingerely 245 Moderation Voter
4 years ago
Edited 4 years ago

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)
0
and make sure not in a local script. Gingerely 245 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

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

Answer this question