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

Why is saving a table to the datastore not working?

Asked by 6 years ago

Here are my scripts:

Local Script:

local weaponData =  --The table
{
    ironPick = false,
    silverPick = false,
    goldPick = false,
    diamondPick = false
}

local remote1 = game.ReplicatedStorage.DataStore
local buyBtn = script.Parent:WaitForChild("ScreenGui").Frame.TextButton

buyBtn.MouseButton1Click:Connect(function() --When the "Buy" Button is clicked we send the table to the Datastore server script

    remote1:FireServer(weaponData)

end)

Server Script:

local remote1 = game.ReplicatedStorage:WaitForChild("DataStore")
local ds = game:GetService("DataStoreService")
local ds1 = ds1:GetDataStore("pickData1Test")

remote1.OnServerEvent:Connect(function(player, weaponData)

    ds1:GetAsync(player.UserId, weaponData)

    ds1:SetAsync(player.UserId, weaponData)

    print("Data saved.")

end)
0
Are you playing the live version of the game? (web.roblox.com) or the play button? If you're playing with the play button, try the live version. chasedig1 115 — 6y
0
Yeah i'm playing the live version with API services on. xXrawr_xdXxOwO 24 — 6y

Answer this question