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

This script doesnt work! It is a regular script. What I'm doing wrong? Not Valid Member Problem!

My script doesnt work! It says LocalPlayer is not valid member and wont add leaderstats Script:

local plr = game.Players.LocalPlayer

game.Players.PlayerAdded:Connect(function()
    local folder = Instance.new("Folder")
    folder.Parent = plr
    folder.Name = "leaderstats"

    local money = Instance.new("IntValue")
    money.Parent = folder
    money.Name = "Money"
end)

3 comments

0

The script isnt there..

0

Check it now now.

0

the script has to be local if it isn't local then LocalPlayer is nil

2 answers

✓ Accepted answer

The client cant change anything on server. Use the script below and put it in a server script.

game.Players.PlayerAdded:Connect(function(plr)
    local folder = Instance.new("Folder")
    folder.Parent = plr
    folder.Name = "leaderstats"

    local money = Instance.new("IntValue")
    money.Parent = folder
    money.Name = "Money"
end)

2 comments

1

Thanks a lot, I'll check it out now. If it works then I will answer you.

1

It really works, you answered very quickly. It would be better if you gave advice but that’s good too. Thank!

Just change the script to a LocalScript, should work fine then, if not then do what herrtt suggested.

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