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

How can I change an OverHeadGui based on a leaderboard value?

Asked by 5 years ago
local BillboardGui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")
local ClonedGui = BillboardGui:Clone()
game.Players.PlayerAdded:Connect(function(player)

    player.CharacterAdded:Connect(function(character)
        if player.Name == "player" then

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



        if game.leaderstats.Wins.Value == 0 then
            ClonedGui.TextLabel.Text = "Guest"
            end

end)
end)

leaderstats is not a valid member of DataModel

1 answer

Log in to vote
0
Answered by
tacotown2 119
5 years ago
local BillboardGui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")
    local ClonedGui = BillboardGui:Clone()  game.Players.PlayerAdded:Connect(function(player)

        player.CharacterAdded:Connect(function(character)
            if player.Name == "player" then

                ClonedGui.Parent = character.Head -- im pretty sure ur way also works but i prefer this
            end



            if player.leaderstats.Wins.Value == 0 then --- if im right the stats were made in the player so u have to search in the player
                ClonedGui.TextLabel.Text = "Guest"
                end

    end)
    end)

im not 100procent if it works but i think this should work

Ad

Answer this question