local checkPoint1 = script.Parent 
local targetSpawn = game.Workspace:WaitForChild("Change this text to the name of the spawnpoint") 
local partGuard = false 

local function onTouched(partTouched) 
	local character = partTouched.Parent 
	local humanoid = character:FindFirstChild("Humanoid") 

	if humanoid and partGuard == false then 
		local player = game.Players:GetPlayerFromCharacter(character) 

		if player then
			partGuard = true 

			-- Save this checkpoint to the player
			if not player:FindFirstChild("CurrentCheckpoint") then
				local cpTag = Instance.new("ObjectValue")
				cpTag.Name = "CurrentCheckpoint"
				cpTag.Value = targetSpawn
				cpTag.Parent = player
			else
				player.CurrentCheckpoint.Value = targetSpawn
			end

			print("Checkpoint 1 activated for " .. player.Name .. "!")

			-- Handle respawn teleportation
			player.CharacterAdded:Connect(function(newCharacter)
				task.wait(0.05)
				local rootPart = newCharacter:WaitForChild("HumanoidRootPart")

				if player:FindFirstChild("CurrentCheckpoint") and player.CurrentCheckpoint.Value == targetSpawn then
					rootPart.CFrame = targetSpawn.CFrame + Vector3.new(0, 4, 0)
				end
			end)

			task.wait(1) -- Debounce reset[cite: 1]
			partGuard = false
		end
	end 
end 

checkPoint1.Touched:Connect(onTouched)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: