So this script is meant to change your respawnlocation to another respawnlocation that is higher. However, the script doesn't work and it doesn't give an error I can work on.

Script:

--AllCheckpoints is a table of all the checkpoint models in the game. Each spawn is in a model.

for i, v in pairs(AllCheckpoints) do
	if not (v == script) then
		v.Spawn.Touched:Connect(function(hit)
			if hit.Parent:FindFirstChild("Humanoid") then
				local char = hit.Parent
				if not (char.Humanoid.Health == 0) then 
					local plrSpawn = game.Players:GetPlayerFromCharacter(char).RespawnLocation
					if plrSpawn:GetAttribute("Stage") < v.Spawn:GetAttribute("Stage") then
						plrSpawn = v.Spawn
					end
				end
			end
		end)
	end
end