I want to know if there is a way to save boolvalues? The only alternative is only using numbervalues and making it so 1 would mean false, and 2 means true. I tried looking around the Developer Forum if there was any answers, however none helped.
Just save the Boolean value, I don’t understand what you need?
Just use DataStoreService
and pass the current value in
1 Like
I did those things, but it isn’t saving.
Can you show me the script you used for Datasaving?
local DataStoreService = game:GetService("DataStoreService")
local myDataStore = DataStoreService:GetDataStore("myDataStore")
game.Players.PlayerAdded:Connect(function(player)
local newboolval = Instance.new("BoolValue")
newboolval.Name = "boolval"
newboolval.Parent = player
local data
local success, errormsg = pcall(function()
data = myDataStore:GetAsync(player.UserId)
end)
if success then
newboolval.Value = data
else
warn("error saving data, error msg:" ..errormsg)
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local success, errormsg = pcall(function()
myDataStore:SetAsync(player.UserId, player:WaitForChild("boolval").Value)
end)
if success then
print("Successfully saved!")
else
warn("Error occured when saving!")
error(errormsg)
end
end)
Nevermind, I realized It didn’t work because I was playtesting it.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.