完成動画
はじめに
使用する主な機能
手順動画
エクスプローラー構成
実装するにあたっての考え方
スクリプトの内容
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
-- アニメーションの読み込み
local AnimA = Instance.new("Animation")
AnimA.AnimationId = "rbxassetid://アニメーションAのID"
local AnimB = Instance.new("Animation")
AnimB.AnimationId = "rbxassetid://アニメーションBのID"
local animTrackA = humanoid:LoadAnimation(AnimA)
local animTrackB = humanoid:LoadAnimation(AnimB)
-- 入力処理
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.One then
print("1キー押された")
animTrackA:Play()
elseif input.KeyCode == Enum.KeyCode.Two then
print("2キー押された")
animTrackB:Play()
end
end)


コメント