RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"Create a script inside server script service that will save bool values"
local DataStoreService = game:GetService("DataStoreService") local myDataStore = DataStoreService:GetDataStore("MyDataStore") game.Players.PlayerAdded:Connect(function(player) local success, data = pcall(function() return myDataStore:GetAsync(player.UserId .. "-BoolValue") end) if success then if data then player:SetAttribute("BoolValue", data) else player:SetAttribute("BoolValue", false) end else warn("Error loading data for player " .. player.Name) end end) game.Players.PlayerRemoving:Connect(function(player) local success, err = pcall(function() myDataStore:SetAsync(player.UserId .. "-BoolValue", player:GetAttribute("BoolValue")) end) if not success then warn("Error saving data for player " .. player.Name) end end)