ジャンプ力アップ

パーツに触れたプレイヤーの Humanoid を使って、ジャンプの高さに関わる値を変えます。

設定とコード例

  1. Workspace に Part を1つ追加します。道路のように少し長めにします。
  2. Part に Script を追加します。
local function onTouch(otherPart)
    local character = otherPart.Parent
    local humanoid = character:FindFirstChildWhichIsA("Humanoid")
 
    if humanoid then    -- 上に乗ったのがプレイヤーだったら
        humanoid.UseJumpPower = true
        humanoid.JumpPower = humanoid.JumpPower + 1
        print (humanoid.JumpPower)  -- ジャンプ力の数値の確認(不要なら削除)
    end
end

script.Parent.Touched:Connect(onTouch)

動作を確かめる

ジャンプの変更が見えない場合は、UseJumpPower と、例で変更するプロパティが対応しているか確認します。

逆引きリファレンスの一覧に戻る