I am not sure how to save it, but i look up in wiki and this is what i made up i not even sure if you can even save BoolValues, but i think the only problem is how do i make contact with it like if the save is this then that. This is in a custom backpack inside workspace and in a model with boolvalues.
game.Players.PlayerAdded:connect(function(s) s:WaitForDataReady() if script.Parent.Value == true then s:SaveBoolean("Found", true) end end) game.Players.PlayerAdded:connect(function(r) while wait() do if script.Parent.Value == false then r:LoadBoolean("Found") break else break end end end)
Since you didn't share whether your method worked or not, I'm going to assume it didn't and write a new script and explain it for you. Also, Data Persistence is outdated, and we use DataStores now (tutorial is in this answer).
local dataStore = game:GetService("DataStoreService"):GetDataStore("insertNameHere") --you can change the name of "insertNameHere" game.Players.PlayerAdded:connect(function(player) player:WaitForDataReady() if script.Parent.Value then --just another way of seeing if something is true dataStore:UpdateAsync(player.Name.." boolean", script.Parent.Value) --DataStores use UpdateAsync instead of Save(Value) to save things. this will create an async that saves this data for later use. use dataStore:GetAsync(key) to get the async. also, the "player.Name..boolean" is the key for the async. end end)
Think of DataStores like this. The DataStore is the file cabinet, the Async is a folder, and the papers in the folder are the users' data.
Looks like you did it right here is a example of how to make a data persistent leaderboard using it.
game.Players.PlayerAdded:connect(function(p) p:WaitForDataReady() if p:LoadInstance("leaderstats")~=nil then p:LoadInstance("leaderstats").Parent=p end end) game.Players. PlayerRemoving:connect(function(p) p:SaveInstance("leaderstats",p.leaderstats) end)
as you can see looks like you did everything correct