Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

VIP Gamepass Point Increase Script Error?

So this is what I have so far.

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        if game.MarketplaceService:PlayerOwnsAsset(player, 1609776713) then
            while true do
            player.leaderstats.Points.Value = player.leaderstats.Points.Value + 15 
            wait(60)
            print("Gave Player 15 Points")
            end
        end
    end)
end)

It gives me this error output

20:47:19.871 - leaderstats is not a valid member of Player
20:47:19.872 - Stack Begin
20:47:19.872 - Script 'Workspace.VIPIncrease', Line 5
20:47:19.873 - Stack End

I looked inside my character while playing and he definitely does have leaderstats as a child. I'm not sure what is going on.

3 comments

1

Is it spelt "leaderstats" and not "Leaderstats" or "LeaderStats"? Maybe use WaitForChild on them. player:WaitForChild("leaderstats")

0

It is spelled "leaderstats". Using "player:WaitForChild("leaderstats")" worked though!!! Thanks!

0

Put an answer to my question and I'll mark you as answered :D

1 answer

✓ Accepted answer

Use WaitForChild on the leaderstats. Seeing this runs right when the player is added and the PlayerAdded event (on another script) fires, they fired twice. So the leaderstats script was still making while the game pass script was expecting it.

This discussion is preserved as it was. New answers, comments, and votes are closed.