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

My script that I typed from ZingoDev does not work any help?

Asked by 5 years ago
local DS = game:GetService("DataStoreService"):GetDataStore("Data")

game.Players.PlayerAdded:Connect(function(plr)

    local l = Instance.new("Folder")
    l.Name "leaderstats"
    l.Parent = plr

    local v = Instance.new("IntValue")
    v.Name = "Points"
    v.Parent = 1

    local file = DS:GetAsync(plr.UserId)

    if file then
        v.Value = file[1]

    end
end)
game.Players.PlayerRemoving:Connect(function(plr)
    DS:SetAsync(plr.UserId,{plr.leaderstats.Points.Value})
end)
0
What's the error/output VitroxVox 884 — 5y
0
The leaderstats don't show up :/. charlesec 36 — 5y

1 answer

Log in to vote
0
Answered by
VitroxVox 884 Moderation Voter
5 years ago

The problem is that the v.Parent = 1 you put the number "1" insted of the letter "l" aka: L

Here a fixed version:

local DS = game:GetService("DataStoreService"):GetDataStore("Data")

game.Players.PlayerAdded:Connect(function(plr)

    local fr = Instance.new("Folder")
    fr.Name "leaderstats"
    fr.Parent = plr

    local v = Instance.new("IntValue")
    v.Name = "Points"
    v.Parent = fr

    local file = DS:GetAsync(plr.UserId)

    if file then
        v.Value = file[1]

    end
end)
game.Players.PlayerRemoving:Connect(function(plr)
    DS:SetAsync(plr.UserId,{plr.leaderstats.Points.Value})
end)
0
or you could just change the "v.Parent = 1" part to "v.Parent = l" VitroxVox 884 — 5y
Ad

Answer this question