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

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

Asked by
Xufly 8
6 years ago
Edited 6 years ago

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)
0
The script isnt there.. herrtt 387 — 6y
0
Check it now now. Xufly 8 — 6y
0
the script has to be local if it isn't local then LocalPlayer is nil DeceptiveCaster 3761 — 6y

2 answers

Log in to vote
0
Answered by
herrtt 387 Moderation Voter
6 years ago

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)
1
Thanks a lot, I'll check it out now. If it works then I will answer you. Xufly 8 — 6y
1
It really works, you answered very quickly. It would be better if you gave advice but that’s good too. Thank! Xufly 8 — 6y
Ad
Log in to vote
0
Answered by
Fako16 13
6 years ago

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

Answer this question