All bool values become true, when the value should be false

Hello!

I am making a datastore that saves a bool value and can load and apply the value of it to a bool value in the player, so it can be used by other scripts. However, whenever it loads the value, it sets it to true, when the actual value (which I print in the console) is false. Does anyone know how I can fix this? Here are the code snippets.

Load Data:

if GetData.indexstats then
	for a,b in pairs(GetData.indexstats) do
		local FoundValue = indexstats:FindFirstChild(a)
		FoundValue.Value = b.Value
		print(b.Value)
	end
end

Save Data:

table.clear(Data.indexstats)
for _,b in pairs(indexstats:GetChildren()) do
	if not b:IsA("BoolValue") then continue end
	Data.indexstats[b.Name] = {
		Value = b.Value,
	}
end

Maybe you changing Values on Client?

3 Likes

You might have changed values on a local script instead of a serverscript. When updating values using local script the changes made will never be seen by the server as you are only updating it locally. I would suggest you double check your local scripts to make sure you are not changing the data locally.

2 Likes