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

MY DATASTORE SCRIPT ISNT WORKING WELL? [closed]

Asked by 4 years ago
PointData = game:GetService("DataStoreService"):GetDataStore("PointData")
RebirthData = game:GetService("DataStoreService"):GetDataStore("RebirthData")

game.Players.PlayerAdded:Connect(function(plr)
    local LB = Instance.new("IntValue")
    LB.Name = "leaderstats"

    local p = Instance.new("IntValue")
    p.Name = "Points"
    p.Value = PointData:GetAsync(plr.userId) or 0

    local r = Instance.new("IntValue")
    r.Name = "Rebirths"
    r.Value = RebirthData:GetAsync(plr.userId) or 0

    LB.Parent = plr
    p.Parent = LB
    r.Parent = LB
end)

game.Players.PlayerRemoving:Connect(function(plr)
    PointData:SetAsync(plr.userId, plr.leaderstats.Points.Value)
    RebirthData:SetAsync(plr.userId, plr.leaderstats.Rebirths.Value)
end)
0
ok why make the title all caps stop screaming at me plz iiClearlyDeveloper 59 — 4y
0
userid should be spelled like "UserId" and you should use the pcall function when calling datastores https://developer.roblox.com/en-us/api-reference/lua-docs/Lua-Globals ForeverBrown 356 — 4y
0
Marked as non-descriptive as the OP doesn't specify what part doesn't work. hiimgoodpack 2009 — 4y
0
I think that giving it medicine will make it work well. programmerHere 371 — 4y

Closed as Non-Descriptive by hiimgoodpack and programmerHere

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?