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

I have a datastore that doesnt work. Help?

Asked by 6 years ago

So i have a datastore in a script in server script service. I want two save two values but I dont want the leaderboard thing, so this is what i did:

local DSService = game:GetService("DataStoreService")
local DS = DSService:GetDataStore("SupDudeIWantToMinecraftAndPlayAkkDayy234435336")
local ChangeMoney = game.ReplicatedStorage.ChangeMoney
local GetMoney = game.ReplicatedStorage.GetMoney
local GetPlayers = game.ReplicatedStorage.GetPlayers
local ChangePlayers = game.ReplicatedStorage.ChangePlayers
game.Players.PlayerAdded:Connect(function(plr)
    local ids = "Id..." .. plr.userId
    local plrdata = DS:GetAsync(ids)

    local plrvalue = Instance.new("NumberValue", plr)
    local monvalue = Instance.new("NumberValue", plr)
    plrvalue.Name = "PlayerVal"
    monvalue.Name = "MoneyVal"
    if plrdata then
    monvalue.Value = plrdata[1] 
    plrvalue.Value = plrdata[2] 
    print("Have Save"..monvalue.Value)
    print("Have Save"..plrvalue.Value)
    else
    monvalue.Value = 0
    plrvalue.Value = 0
    print("No Save"..monvalue.Value)
    print("No Save"..plrvalue.Value)
    end





end)





game.Players.PlayerRemoving:Connect(function(plr)
    local ids = "Id..." .. plr.userId
    local money = math.floor(plr["MoneyVal"].Value)
    local plrval = math.floor(plr["PlayerVal"].Value)
    local SaveTable = {money, plrval}

    DS:SetAsync(ids, SaveTable)
0
You're forgetting an "end)" at the end. hiimgoodpack 2009 — 6y
0
Still doesnt work Nilsen84 1 — 6y

Answer this question