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

overhead billboard gui only appears on 1 player?

Asked by 4 years ago

I've made an overhead billboard gui that works fine but when i tried testing with more than 1 player it switches places to the recent joined player. heres the script

local name = game.ServerStorage.namegui:Clone()


game.Players.PlayerAdded:Connect(function(p)
    p.CharacterAdded:Connect(function(c)
        local hed = c.Head
        name.Parent = c.Head
        hed.namegui.TextButton.Text = p.Name 

    end)
end)

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Your first variable is saying you have only one copy of the namegui so the way to fix that is to put that between line 5 and 6 like this!



game.Players.PlayerAdded:Connect(function(p) p.CharacterAdded:Connect(function(c) if c ~= nil and c:FindFirstChild('Head') then -- Just to make sure the character has loaded completely local name = game.ServerStorage.namegui:Clone() local hed = c.Head name.Parent = c.Head hed.namegui.TextButton.Text = p.Name end end) end)
Ad
Log in to vote
0
Answered by
U_srname 152
4 years ago

What you are doing in your code is that you are cloning it only once, when the script first runs. What you have to do is clone it every single time a player joins.

Here's your new code:

local name = game.ServerStorage.namegui:Clone()

game.Players.PlayerAdded:Connect(function(p)
    p.CharacterAdded:Connect(function(c)
        local head = c.Head
        name.Parent = head
        head.namegui.TextButton.Text = p.Name
    end)
end)

Answer this question