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

[Solved] How would I store configurations using datastore?

Asked by 5 years ago
Edited 5 years ago

So I am making a game where players make their own suit & can eventually build plating on it. But I am having trouble coming up with a way to store the player's 'plating configuration' since each plate has to have a 'vector 3' sort of value as well as which part it is attached to & what material it is. how would I store these five different values easily in a table & then store it with datastore?

here is some code I was experimenting with but I am still having trouble:

local DSS = game:GetService("DataStoreService")
local PltngConfig = DSS:GetDataStore("PlatingConfig")

game.Players.PlayerAdded:connect(function(player)
    if PltngConfig:GetAsync(player.userid) ~= nil then
        PlatingConfig = PltngConfig:GetAsync(player.userid)
    else
        --code to make new data will go here
    end
end)


game.Players.PlayerRemoving:connect(function(player)
    PltngConfig:SetAsync(player.userid, PlatingConfig)

end)

1 answer

Log in to vote
1
Answered by 5 years ago

Nvm, I just found out how to make tables within tables which allows me to save 5 values per key.

Ad

Answer this question