So, I was making some minigames, it was all perfect until something showed up. The Data Store saves how many wins a player had and kept the data the same when the player rejoined, but the new win overwrote all the previous ones. e.g. if someone had 10 wins, instead of doing +1 win it would make it 1 win. I put the script inside a part that marks the end for an obby. Here it is:

active = false
game.Workspace.LavaRise.Event:Connect(function(h)
	active = false
	script.Parent.Touched:Connect(function(hit)
		wait(.1)
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
			if not active then
				active = true
				hit.Parent.HumanoidRootPart.Position = game.Workspace.SpawnLocation.Position
				wait(1)
				game.Players[hit.Parent.Name].leaderstats.Wins.Value += 1
				wait(1)
			end
		end
	end)
end)

No error code seems to show up. What do I do?

1 comment

0

Edit: The wins go up when you're still in the server, but when you leave, it shows however wins you had previously at first, but then it gets overwritten.