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 players?

Asked by 3 years ago

For some reason I keep getting this error. I have tried checking to see if there are any typos but there are none. This is also on a normal script. I need help, thanks.

game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function()

        local leaderstats = game:GetService("Players").leaderstats.Stage.Value

        if leaderstats >= 40 then
            local Halo = game.ServerStorage.RainbowHalo:Clone()
            Halo.Parent = Player.Character
        end
    end)
end)

1 answer

Log in to vote
0
Answered by 3 years ago

game.Players is like folder with players, so leaderstats isnt in that folder. You need to get Player. You Already have player from PlayerAdded function so you can use Player.leaderstats....

0
I did it but now its not giving me the halo NotANinja_9210 7 — 3y
0
Is the value of stage bigger than 40 when you join the game? That script is checking that value Just when you joined. You can use while wait() do so that will be looping and checking if the value is bigger than 40 jerryisgod29 176 — 3y
0
Or Changed function - Player.leaderstats.Stage.Changed:Connect(function() jerryisgod29 176 — 3y
Ad

Answer this question