--

local target={}
local stageChunk = script.Parent
local function onPartTouch(otherPart)
	warn("1")
	local partParent = otherPart.Parent
	local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")
	if humanoid then
		local player = Players:GetPlayerFromCharacter(partParent)

		local flag=0
		for index = 1, #target do
			if (target[index] == player) then
				flag=1
			end
		end		
		if flag == 0 then
			local leaderstats = player.leaderstats
			local stageStat = leaderstats and leaderstats:FindFirstChild("Stage")
			if stageStat then
				stageStat.Value = stageStat.Value + added
				table.insert(target, player)
				
				-- обновление данных в базе данных
				local stageStore = DataStore2("stage", player)
				-- stageStore:Increment(added) -- Give them 1 point
				stageStore:Set(stageStore:Get(0) + added )
			end
		end
	end
end

stageChunk.Touched:Connect(onPartTouch)
