Hi there! I have two scripts - one for playerentering and one for playerremoving. For some reason, it doesn't save :/ Any ideas? Thanks
1.
local DataStore = game:GetService("DataStoreService"):GetDataStore("ProductsInShop") game.Players.PlayerAdded:connect(function(player) local knife = Instance.new("BoolValue", player) knife.Name = "OwnKnife" local cloak = Instance.new("BoolValue", player) cloak.Name = "OwnCloak" local key = "player-"..player.userId local savedvalues = DataStore:GetAsync(key) if savedvalues then knife.OwnKnife.Value = savedvalues[1] cloak.Value = savedvalues[2] else local ValueToSave = {knife.Value, cloak.Value} DataStore:SetAsync(key, ValueToSave) end end)
2.
local datastore = game:GetService("DataStoreService"):GetDataStore("ProductsInShop") game.Players.PlayerRemoving:connect(function(player) local key = "player-"..player.UserId local valuestosave = {player.OwnKnife.Value, player.OwnCloak.Value} datastore:SetAsync(key, valuestosave) end)