Basic Usage Monster/NPC
AnimationIds
Configure your AnimationIds
module:
-- Inside of `ReplicatedStorage.Animations.Deps.AnimationIds`
local ninjaJumpR15AnimationId = 656117878
local AnimationIds = {
Player = { -- Rig type of "Player" (required for any animations that will run on player characters)
Jump = ninjaJumpR15AnimationId -- Path of "Jump"
}
Monster = { -- [ADDED]
Attack = 00000000
}
}
return AnimationIds
AnimationsServer
Playing an animation on the server on a Monster:
-- In a ServerScript
local Animations = require(game.ReplicatedStorage.Animations.Package.AnimationsServer)
Animations:Init()
local monsterModel = workspace.Monster
Animations:Register(monsterModel, "Monster") -- Ties the "Monster" animations in `AnimationIds` module to the rig. Do once.
Animations:LoadAllTracks(monsterModel)
Animations:PlayTrack(monsterModel, "Attack")
AnimationsClient
Playing an animation on the client on a Monster:
-- In a LocalScript
local Animations = require(game.ReplicatedStorage.Animations.Package.AnimationsClient)
Animations:Init()
local monsterModel = workspace:WaitForChild("Monster")
Animations:RegisterRig(monsterModel, "Monster") -- Ties the "Monster" animations in `AnimationIds` module to the rig. Do once.
Animations:LoadAllRigTracks(monsterModel)
Animations:PlayRigTrack(monsterModel, "Attack")