チェックポイントの作り方
入門作例更新日:2026年11月13日Luauの型チェック済み
ひとことで言うと
ふれると、そこが次の復活地点になるチェックポイントです。アスレチックで、落ちても途中から始められるようになります。
この記事で使うAPI
完成するもの
ふれると、そこが次の復活地点になるチェックポイントです。アスレチックで、落ちても途中から始められるようになります。
スクリプト
(Script/置く場所:SpawnLocationの中)
local Players = game:GetService("Players")
local checkpoint = script.Parent :: SpawnLocation
checkpoint.Touched:Connect(function(hit)
local character = hit.Parent
if not character or not character:IsA("Model") then
return
end
local player = Players:GetPlayerFromCharacter(character)
if player then
player.RespawnLocation = checkpoint
end
end)
しくみ
SpawnLocationの中にスクリプトを入れ、ふれたプレイヤーのRespawnLocation(復活する場所)を、そのSpawnLocationにしています。
アレンジしてみよう
- チェックポイントごとに色を変える
- 何番目のチェックポイントかをリーダーボードに表示する