Boolvalues Returning False Despite Being True

Im trying to save multiple bool values on whether or not the player owns a certain item to datastore, its always false even when the value is true so i tried printing the value of one and it returns false even though it is definitely set to true, please help!

Script:
local datastoreService = game:GetService(“DataStoreService”)
local ds1 = datastoreService:GetDataStore(“Currency”)
local ds2 = datastoreService:GetDataStore(“Swords”)
local ds3 = datastoreService:GetDataStore(“Flags”)
local serverStorage = game:GetService(“ServerStorage”)

game.Players.PlayerAdded:Connect(function(player)
	local currency = Instance.new("Folder")
    currency.Name = "Currency"
    currency.Parent = player
	local rainbows = Instance.new("IntValue")
	rainbows.Parent = currency
	rainbows.Name = "Rainbows"
	local items = Instance.new("Folder")
	items.Name = "Items"
    items.Parent = player
	local swords = Instance.new("Folder")
	swords.Name = "Swords"
	swords.Parent = items
	local flags = Instance.new("Folder")
	flags.Name = "Flags"
	flags.Parent = items

    local swordData = ds2:GetAsync(player.UserId)

	local swordsOwned = {}
	swordsOwned = swordData
	print(swordsOwned[1])

	for i, v in ipairs(serverStorage.SwordSaves:GetChildren()) do
		local clone = v:Clone()
		clone.Parent = swords
		clone.Value = swordsOwned[i]
		print(swordsOwned[i])
	end
	
	
	
end)
game.Players.PlayerRemoving:connect(function(player)
	print(player.Items.Swords["Black Techno"].Value)
	wait(.5)
	ds2:SetAsync(player.UserId, {
		player.Items.Swords["Black Techno"].Value,
		player.Items.Swords["Bluesteel Sword"].Value,
		player.Items.Swords["Bombastic Blade"].Value,
		player.Items.Swords["Iron Sword"].Value,
		player.Items.Swords["Majestic Blade"].Value,
		player.Items.Swords["Mars"].Value,
		player.Items.Swords["Nature Blade"].Value,
		player.Items.Swords["Overseer"].Value,
		player.Items.Swords["Rainbow Glow"].Value,
		player.Items.Swords["Rainbow Storm"].Value,
		player.Items.Swords["Sparkle Time Blade"].Value,
		player.Items.Swords["Witch Blade"].Value
	})
	local swordData = ds2:GetAsync(player.UserId)
	
	local swordsOwned = {}
	swordsOwned = swordData
	print(unpack(swordsOwned))
end)

game:BindToClose(function()
    wait(2)
end)
1 Like

Could you provide the line in which you print the boolean value?

1 Like

Are you changing the value in the client? If so, thats the problem.

i print just the first one as a test after loading the data,

And then i also print that same bool here right before saving the data