Tool idle and walk animations not playing?
I have a sword tool that contains two scripts, one named "swordAnimations" and the other "whenEquipped". Currently, I'm trying to have a tool idle animation play when standing still and a tool walk animation to play when the latter happens, but the default ROBLOX animations still play. The "whenEquipped" script is working fine, but the "swordAnimations" script is what I'm concerned with.
There are currently no errors in the output bar when testing this.
"swordAnimations" script:
03 | character = script.Parent.Parent |
04 | humanoid = script.Parent.Parent:FindFirstChild( "Humanoid" ) |
06 | sword_idle = humanoid:LoadAnimation(script.sword_idle) |
07 | sword_walk = humanoid:LoadAnimation(script.sword_walk) |
11 | local function swordAnimations() |
12 | local state = humanoid:GetState() |
13 | if character.Torso.Velocity < 5 then |
14 | local ActiveTracks = humanoid:GetPlayingAnimationTracks() |
15 | for _,v in pairs (ActiveTracks) do |
19 | print ( "sword idle play" ) |
20 | elseif state = = Enum.HumanoidStateType.Running then |
21 | local ActiveTracks = humanoid:GetPlayingAnimationTracks() |
22 | for _,v in pairs (ActiveTracks) do |
26 | print ( "sword walk play" ) |
33 | character.Torso:GetPropertyChangedSignal( "Velocity" ):Connect(swordAnimations) |
"whenEquipped" script:
03 | animationsPlaying = script.Parent.swordAnimations |
07 | animationsPlaying.Disabled = true |
09 | local function onEquip() |
10 | animationsPlaying.Disabled = false |
14 | local function onUnequip() |
15 | animationsPlaying.Disabled = true |
21 | script.Parent.Equipped:Connect(onEquip) |
22 | script.Parent.Unequipped:Connect(onUnequip) |
Any help or inquiries would be greatly appreciated!