0 views0 copies0 likes

Checkpoint Return with Named Stages

Universal script

Copy it, then test it in your own Studio place.

Utilities Verified

Script code

24 lines ยท 1.0 KB
Download
local Players = game:GetService("Players")local folder = workspace:WaitForChild("CheckpointPads")local function bind(player)	player:SetAttribute("CheckpointStage", 0)	player.CharacterAdded:Connect(function(character)		character:WaitForChild("HumanoidRootPart")		local pad = folder:FindFirstChild(tostring(player:GetAttribute("CheckpointStage")))		if pad and pad:IsA("BasePart") then character:PivotTo(pad.CFrame + Vector3.new(0, 3, 0)) end	end)endPlayers.PlayerAdded:Connect(bind)for _, player in Players:GetPlayers() do bind(player) endfor _, pad in folder:GetChildren() do	local stage = tonumber(pad.Name)-- โ€ฆopen Get script for the full source

About this script

Create Workspace.CheckpointPads and put anchored parts named 1, 2 and so on inside it. Each player's latest greater stage is stored on the Player and used to place their next character three studs above the pad. Repeated limb contacts cannot move a player back to an earlier stage. Checkpoints reset when the player rejoins, which fits short obstacle courses and development tests.

Comments

Share what works, ask questions, or report an issue.

0

Log in to leave a comment.

No comments yet

Be the first to share your thoughts!

Raw Luau source

local Players = game:GetService("Players")
local folder = workspace:WaitForChild("CheckpointPads")
local function bind(player)
	player:SetAttribute("CheckpointStage", 0)
	player.CharacterAdded:Connect(function(character)
		character:WaitForChild("HumanoidRootPart")
		local pad = folder:FindFirstChild(tostring(player:GetAttribute("CheckpointStage")))
		if pad and pad:IsA("BasePart") then character:PivotTo(pad.CFrame + Vector3.new(0, 3, 0)) end
	end)
end
Players.PlayerAdded:Connect(bind)
for _, player in Players:GetPlayers() do bind(player) end
for _, pad in folder:GetChildren() do
	local stage = tonumber(pad.Name)
	if stage and pad:IsA("BasePart") then
		pad.Touched:Connect(function(hit)
			local character = hit:FindFirstAncestorOfClass("Model")
			local player = character and Players:GetPlayerFromCharacter(character)
			if player and stage > (player:GetAttribute("CheckpointStage") or 0) then
				player:SetAttribute("CheckpointStage", stage)
			end
		end)
	end
end