I’m trying to animate an idle and a walk script for a sword I’m making but the default animations are overlapping with my idle and walk animation.
When the player is idle I just want my animation to play not the default animation that makes the player bob up and down and look side to side. All of the solutions that I have found completely delete the default animations but that isn’t what I want to do. If the player unequips the sword I want it to go back to the default animations. I have also set the animation priority to “Action” which in theory should override the default animations but doesn’t.
The better solution is to make your own default animation script. Thats what I was trying to help you avoid. It shouldnt be to hard though to use the default roblox aniamtion script and edit it. If you edit it and want to use it though you have to destroy the default aniamtion script or I think it might automatically not put the script in if it already detects an Animate script in the character.
I figured out why the default animations were overlapping with my custom animation even though the priority was set to “Action.” When you set an animations priority the priority will only count for parts you have animated. Because I only animated the Handle of the sword only the Handle part has the priority Action which means that the other animations (Roblox’s default animations) has priority over everything else.
Hey, sorry I didn’t understand this solution. What do you mean “The Handle part the priority Action”? Animations have priorities, not meshes or parts. Also what’s the fix for this?
There’s a other way I found that is easier but it won’t play the falling animation (until you hit the ground) if you turn on it in the air:
--(LOCAL SCRIPT)
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer :: Player
local function GetCharacter(): Model
return LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
end
local function GetHumanoid(): Humanoid
local humanoid = GetCharacter():FindFirstChildOfClass("Humanoid") :: Humanoid
repeat
humanoid = GetCharacter():FindFirstChildOfClass("Humanoid") :: Humanoid
task.wait()
until humanoid
return humanoid :: Humanoid
end
local function GetRootPart(): Part
local rootpart = GetCharacter():FindFirstChild("HumanoidRootPart") :: Part
repeat
rootpart = GetCharacter():FindFirstChild("HumanoidRootPart") :: Part
task.wait()
until rootpart
return rootpart :: Part
end
local function GetAnimator(): Animator
local animator = GetHumanoid():FindFirstChildOfClass("Animator") :: Animator
repeat
animator = GetHumanoid():FindFirstChildOfClass("Animator") :: Animator
task.wait()
until animator
return animator :: Animator
end
local function GetAnimateScript(): LocalScript
local animateScript = GetCharacter():FindFirstChild("Animate") :: LocalScript
repeat
animateScript = GetCharacter():FindFirstChild("Animate") :: LocalScript
task.wait()
until animateScript
return animateScript :: LocalScript
end
local DefaultAnimations = {}
task.spawn(function()
local AnimateScript = GetAnimateScript()
AnimateScript.DescendantAdded:Connect(function(descendant)
if descendant:IsA("Animation") then
DefaultAnimations[descendant.Name] = descendant
end
end)
AnimateScript.DescendantRemoving:Connect(function(descendant)
if descendant:IsA("Animation") then
DefaultAnimations[descendant.Name] = nil
end
end)
for i, v in ipairs(AnimateScript:GetDescendants()) do
if v:IsA("Animation") then
DefaultAnimations[v.Name] = v
end
end
end)
local function PauseFromPlayingDefaultAnimations(): nil
local AnimateScript = GetAnimateScript()
AnimateScript.Enabled = false
for i,v in ipairs(GetAnimator():GetPlayingAnimationTracks()) do
if DefaultAnimations[v.Name] then
v:Stop()
end
task.wait()
end
return nil
end
local function UnpauseFromPlayingDefaultAnimations(): nil
GetAnimateScript().Enabled = true
return nil
end