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

" leaderstats is not a valid member of Player "Players.Manby7"?

Asked by
Manby7 32
3 years ago

By the way, this is a local script.

local player = game.Players.LocalPlayer

local Plus = player.PlayerGui.PlusMaterialNotification

player.leaderstats.Steel.Changed:Connect(function()

    local tab = Plus:GetChildren()

    local random = math.random(1,#tab)

    local selected = tab[random]

    print("e")

    selected.Text = "+5 Steel"

    wait(1.3)

    selected.Text = ""

end)

player.leaderstats.Wood.Changed:Connect(function()

    local tab = Plus:GetChildren()

    local random = math.random(1,#tab)

    local selected = tab[random]

    print("e")

    selected.Text = "+5 Wood"

    wait(1.3)

    selected.Text = ""

end)

player.leaderstats.Stone.Changed:Connect(function()

    local tab = Plus:GetChildren()

    local random = math.random(1,#tab)

    print("e")

    local selected = tab[random]

    selected.Text = "+5 Stone"

    wait(1.3)

    selected.Text = ""

end)

Whenever I run the script, I get this error: leaderstats is not a valid member of Player "Players.Manby7" Any help would be greatly appreciated!

0
Do you have a leaderstats folder in the player or character? LeedleLeeRocket 1257 — 3y
0
Yes, and it is all spelled correctly. i checked more times than i can count lol Manby7 32 — 3y
0
Are your leaderstats already established on the server? Here you haven't created them yet, only called for a Change signal. ABK2017 406 — 3y
0
Yes, they were already created. Just for clerification I looked inside of the Player. It also showed it on the top right Manby7 32 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

Try: player:WaitForChild("leaderstats")

The folder may not have loaded.

0
This worked. Thank you! Manby7 32 — 3y
Ad

Answer this question