I have a problem that I need to fix in my saving script that prevents it from saving BoolValues and loading saved BoolValues. I am very bad with DataStores, so there is probably a simple solution that I am overlooking.
The only thing the output said was this, when I left the game:
I have already tested the game in Roblox, and that did not fix my issue either.
I have already searched for solutions to my problem, but my problem is too specific to find a solution on the web.
The code is below.
local DataStoreService = game:GetService("DataStoreService");
local DataStore = DataStoreService:GetDataStore("CheckpointDatastore");
local StartBlock = game.Workspace.StartBlock
game.Players.PlayerAdded:Connect(function(player)
local ObbyCompleted = Instance.new("BoolValue", player)
local Void1Completed = Instance.new("BoolValue", player)
ObbyCompleted.Name = ("ObbyCompleted")
Void1Completed.Name = ("Void1Completed")
ObbyCompleted.Value = DataStore:GetAsync(player.UserId) or false
Void1Completed.Value = DataStore:GetAsync(player.UserId) or false
if Void1Completed.Value == true then StartBlock.Material = Enum.Material.Ice elseif
ObbyCompleted.Value == true then StartBlock.Material = Enum.Material.Granite elseif
ObbyCompleted.Value == false then StartBlock.Material = Enum.Material.Plastic
end
end)
game.Players.PlayerRemoving:Connect(function(player)
DataStore:SetAsync(player.UserId, player:WaitForChild("ObbyCompleted").Value)
DataStore:SetAsync(player.UserId, player:WaitForChild("Void1Completed").Value)
end)
This is also my first post, so any tips for the Devforums would be appreciated!
Thanks for helping!