So, i was working on obbies beaten amount, but when player finished the obby, value doesn't increase

dataStore = game:GetService("DataStoreService")
SoHStore = dataStore:GetDataStore("SoHStore")
db = false

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		if db == false then
			db = true
			local player = game.Players:GetPlayerFromCharacter(hit.Parent)
			local co = SoHStore:GetAsync(player.userId)
			
			if co == false then
				SoHStore:SetAsync(player.userId,true)
				player.leaderstats.Steeples.Value = player.leaderstats.Steeples.Value + 1
			end
			
			player:LoadCharacter()
			wait(6)
			db = false
		end
	end
end)

What is wrong with the script?

2 comments

0

if co == false then, Why are you checking if its false? that will only increase the value if getasync didnt receive any data

0

i am making so, that player won't try to get more amount of obbies beaten just from 1 obby