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

Datastore not saving values, Im out of solutions for now, Any ideas?

Asked by 3 years ago

For reference,"$" Is the value im attempting to save (Player.leaderstats.$.Value)

local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("Stats")

game.Players.PlayerAdded:Connect(function(Player)
    print("joined")
    local leaderstats = Player:WaitForChild("leaderstats")
    local Money = leaderstats:WaitForChild("$")
    Money.Value = DataStore:GetAsync(Player.UserId) or 0
    print("madeitthisfar)
end)

game.Players.PlayerRemoving:Connect(function(Player)
    DataStore:SetAsync(Player.UserId, Player.leaderstats.Money.Value)
end)

Obviously this wont work in studio, But it doesnt work in public servers either. Money will always have a value of 0 on join no matter

Ive spent atleast an hour trying to work around what could possibly be wrong nothing has caught my eye.

0
Ignore the broken print *print("madeitthisfar) goblinc0re 1 — 3y
0
In line 13, you put leaderstats.Money instead of leaderstats.$ AProgrammR 398 — 3y

Answer this question