RobloxでObbyにあるような触れると即死するパーツを作成する
ベースとなるパーツを作成、名前をDeathTrapにする

パーツの配下にスクリプトを作成、名前をDeathTrapScriptにする

スクリプトを以下のように編集
-- パーツを取得 local part = script.Parent -- パーツに触れたときに呼び出される local function onPartTouch(otherPart) -- 触れた対象がプレイヤーだったら体力を0にする local humanoid = otherPart.Parent:FindFirstChild("Humanoid") if humanoid then humanoid.Health = 0 end end -- パーツに触れたときのイベントを登録する part.Touched:Connect(onPartTouch)
結果
