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

I have a little problem with my overhead guis?

Asked by 2 years ago

So when a player joins, he should have a gui over his head displaying his wins. Some people have it, and some don't. Please help.

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(char)
        if char:FindFirstChild("Head") and player then
            local clone = script.BillboardGui:Clone()
            clone.Parent = char:FindFirstChild("Head")
            clone.TextLabel.Text = (player:WaitForChild("leaderstats"):WaitForChild("Wins").Value)
            clone.TextLabel.TextColor3 = Color3.fromRGB(255, 242, 208)
            player:WaitForChild("leaderstats"):WaitForChild("Wins"):GetPropertyChangedSignal("Value"):Connect(function()
                clone.TextLabel.Text = (player:WaitForChild("leaderstats"):WaitForChild("Wins").Value)
            end)
        end
    end)
end)
0
Where is this placed and what type of script is it theking66hayday 841 — 2y
0
It's a server script and its in workspace sixfirez 33 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

Maybe try adding local head = char:WaitForChild("Head") directly after the characteradded in case it hasn't loaded yet.

Ad

Answer this question