I do not understand this error

I am trying to make three values: deaths, seconds and stage
I want the deaths to go up by one every time someone dies, the seconds should go up once a second by one and the stages should go up by one when someone touches the checkpoint.

Also, I want them to be all saveable when a player leaves the game
The error:
[07:22:28.388 - ServerScriptService.Checkpoints Script:25: invalid argument #3 (string expected, got table)]

07:22:28.390 - Stack Begin

[07:22:28.391 - Script ‘ServerScriptService.Checkpoints Script’, Line 25]
07:22:28.392 - Stack End

Code:

local dss = game:GetService("DataStoreService")
local Datastore = dss:GetDataStore("ObbyData")
local checkpoints = workspace.Checkpoints
					
	local Players = game:GetService("Players")

game:BindToClose(function()
    for _, Player in pairs(Players:GetPlayers()) do
        Player:Kick("This server is shutting down")
    end
    wait(3)
end)local Players = game:GetService("Players")

print("Checkpoints leaderstats working")
print("Deaths leaderstats working")
print("Time leaderstats working")
game.Players.PlayerAdded:Connect(
    function(plr)
        local obbyData = Datastore:GetAsync(plr.UserId .. "-obbyStageProgress")
        local stats = Instance.new("Folder")
        stats.Name = "leaderstats"
        stats.Parent = plr
        local stage = Instance.new("StringValue")
        stage.Name = "Stage"
        stage.Value = obbyData or 1
        stage.Parent = stats
        local wipeouts = Instance.new("IntValue")
        wipeouts.Name = "Deaths"
        wipeouts.Value = 0
        wipeouts.Parent = stats

        local second = Instance.new("IntValue")
        second.Name = "Seconds"
	        second.Value = 0
	second.Parent = stats
       
        local char = plr.Character or plr.CharacterAdded:Wait()
        char:WaitForChild("HumanoidRootPart").CFrame = checkpoints[stage.Value].CFrame
        char.Humanoid.Touched:Connect(
            function(touch)
                if touch.Parent == checkpoints then
                    if (tonumber(touch.Name) and tonumber(touch.Name) > tonumber(stage.Value)) or touch.Name == "End" then
                        stage.Value = touch.Name
                        pcall(
                            function()
                                Datastore:SetAsync(
                                    plr.UserId .. "-obbyStageProgress",
                                    {plr.leaderstats.Stage.Value, plr.Deaths.Value, plr.Seconds.Value}
                                )
                            end
                        )
                    end
                end

                game.Players.PlayerRemoving:Connect(
                    function(player)
                        Datastore:SetAsync(player.UserId, {player.leaderstats.Stage.Value, player.Deaths.Value}) -- Change "Money" with your currency.
                    end
                )
                plr.CharacterAdded:Connect(
                    function(char)
                        local hrp = char:WaitForChild("HumanoidRootPart")
                        local humanoid = char:WaitForChild("Humanoid")
                        hrp:GetPropertyChangedSignal("CFrame"):Wait()
                        hrp.CFrame = checkpoints[stage.Value].CFrame
			humanoid.Died:Connect(function()
			wipeouts.Value = wipeouts.Value + 1	
			end)
		
                        humanoid.Touched:Connect(
                            function(touch)
				                                
				
                                if touch.Parent == checkpoints then
                                    if
                                        (tonumber(touch.Name) and tonumber(touch.Name) > tonumber(stage.Value)) or
                                            touch.Name == "End"
                                     then
                                        stage.Value = touch.Name
                                        while true do
                                            wait(2)
                                            second.Value = second.Value + 1
                                        end
                                        pcall(
                                            function()
                                                game.Players.PlayerRemoving:Connect(
                                                    function(player)
                                                        Datastore:SetAsync(
                                                            plr.UserId .. "-obbyStageProgress",
                                                            {
                                                                player.leaderstats.Stage.Value,
                                                                player.Deaths.Value,
                                                                player.Seconds.Value
                                                            }
                                                        )
                                                    end
                                                )
                                            end
                                        )
                                    end
                                end
                            end
                        )
                    end
                )
            end
        )
    end
)
			
					

				
		



	```

its happening when you set obbyData to the value of the stage, since the value must be a string and not a table, try doing this:

local dss = game:GetService("DataStoreService")
local Datastore = dss:GetDataStore("ObbyData")
local checkpoints = workspace.Checkpoints
					
	local Players = game:GetService("Players")

game:BindToClose(function()
    for _, Player in pairs(Players:GetPlayers()) do
        Player:Kick("This server is shutting down")
    end
    wait(3)
end)local Players = game:GetService("Players")

print("Checkpoints leaderstats working")
print("Deaths leaderstats working")
print("Time leaderstats working")
game.Players.PlayerAdded:Connect(
    function(plr)
        local obbyData = Datastore:GetAsync(plr.UserId .. "-obbyStageProgress")
        local stats = Instance.new("Folder")
        stats.Name = "leaderstats"
        stats.Parent = plr
        local stage = Instance.new("StringValue")
        stage.Name = "Stage"
        stage.Value = (obbyData and obbyData[1]) or 1
        stage.Parent = stats
        local wipeouts = Instance.new("IntValue")
        wipeouts.Name = "Deaths"
        wipeouts.Value =  0
        wipeouts.Parent = stats

        local second = Instance.new("IntValue")
        second.Name = "Seconds"
	        second.Value = 0
	second.Parent = stats
       
        local char = plr.Character or plr.CharacterAdded:Wait()
        char:WaitForChild("HumanoidRootPart").CFrame = checkpoints[stage.Value].CFrame
        char.Humanoid.Touched:Connect(
            function(touch)
                if touch.Parent == checkpoints then
                    if (tonumber(touch.Name) and tonumber(touch.Name) > tonumber(stage.Value)) or touch.Name == "End" then
                        stage.Value = touch.Name
                        pcall(
                            function()
                                Datastore:SetAsync(
                                    plr.UserId .. "-obbyStageProgress",
                                    {plr.leaderstats.Stage.Value, plr.Deaths.Value, plr.Seconds.Value}
                                )
                            end
                        )
                    end
                end

                game.Players.PlayerRemoving:Connect(
                    function(player)
                        Datastore:SetAsync(player.UserId, {player.leaderstats.Stage.Value, player.Deaths.Value}) -- Change "Money" with your currency.
                    end
                )
                plr.CharacterAdded:Connect(
                    function(char)
                        local hrp = char:WaitForChild("HumanoidRootPart")
                        local humanoid = char:WaitForChild("Humanoid")
                        hrp:GetPropertyChangedSignal("CFrame"):Wait()
                        hrp.CFrame = checkpoints[stage.Value].CFrame
			humanoid.Died:Connect(function()
			wipeouts.Value = wipeouts.Value + 1	
			end)
		
                        humanoid.Touched:Connect(
                            function(touch)
				                                
				
                                if touch.Parent == checkpoints then
                                    if
                                        (tonumber(touch.Name) and tonumber(touch.Name) > tonumber(stage.Value)) or
                                            touch.Name == "End"
                                     then
                                        stage.Value = touch.Name
                                        while true do
                                            wait(2)
                                            second.Value = second.Value + 1
                                        end
                                        pcall(
                                            function()
                                                game.Players.PlayerRemoving:Connect(
                                                    function(player)
                                                        Datastore:SetAsync(
                                                            plr.UserId .. "-obbyStageProgress",
                                                            {
                                                                player.leaderstats.Stage.Value,
                                                                player.Deaths.Value,
                                                                player.Seconds.Value
                                                            }
                                                        )
                                                    end
                                                )
                                            end
                                        )
                                    end
                                end
                            end
                        )
                    end
                )
            end
        )
    end
)
			
					

				
		

My stages now work but my deaths do not save and every time I die it goes up like 200 times and my seconds do not go up even though I put a while true loop for it to go up by 1 every second (i copied your code(thanks))