Alright, here’s the main issue. Whenever I open up a tool that has a set of animations (Run anim, walk anim, and idle anim(s)) it is set up to replace the main animations on equip and put back the main animations on de-quips. It does this by stopping all animation tracks, setting the animations to the ones I want to use, but I am missing the next part. Unless I stop to idle when running or vice versa, since I ended the previous animation tracks w/o update, they have the character in the no anim pose. Without stopping previous animations, the previous tracks keep playing, such as the idle keeps using the old one until i move or do something that would update it.
Here is my (really bad) code:
organimidle = "rbxassetid://18622358007"
organimrun = "rbxassetid://18623845740"
script.Parent.Equipped:Connect(function()
for i,v in ipairs(script.Parent:GetChildren()) do
if v:IsA("Part") or v:IsA("MeshPart") or v:IsA("BasePart") then
if v.Anchored then
v.Anchored = false
end
end
end
hum = script.Parent.Parent.Humanoid
anim = script.Parent.Parent:FindFirstChild("Animate")
anim.run.RunAnim.AnimationId = "rbxassetid://18817923614" --"rbxassetid://18624348426"
anim.walk.WalkAnim.AnimationId = "rbxassetid://18817923614"
anim.idle.Animation1.AnimationId = "rbxassetid://18622750448"
anim.idle.Animation2.AnimationId = "rbxassetid://18622750448"
for _, playingTrack in hum.Animator:GetPlayingAnimationTracks() do
playingTrack:Stop(0)
end
--local Run = Instance.new("Animation")
--Run.AnimationId ="rbxassetid://18817923614"
--local ranTrack = hum:LoadAnimation(Run)
--ranTrack.Priority = Enum.AnimationPriority.Movement
--ranTrack.Looped = true
--local Walk = Instance.new("Animation")
--Walk.AnimationId = "rbxassetid://18817923614"
--local wanTrack = hum:LoadAnimation(Walk)
--wanTrack.Priority = Enum.AnimationPriority.Movement
--wanTrack.Looped = true
end)
cycle = 1
local slash1 = Instance.new("Animation")
slash1.AnimationId = "rbxassetid://18622720414"
local slash2 = Instance.new("Animation")
slash2.AnimationId = "rbxassetid://18622725097"
local slash3 = Instance.new("Animation")
slash3.AnimationId = "rbxassetid://18622729087"
local slash4 = Instance.new("Animation")
slash4.AnimationId = "rbxassetid://18622731997"
script.Parent.Activated:Connect(function()
if cycle == 1 then
local animationTrack = hum:LoadAnimation(slash1)
animationTrack:Play();
cycle = 2
script.Parent.Enabled = false
animationTrack.Stopped:Wait()
script.Parent.Enabled = true
elseif cycle == 2 then
local animationTrack = hum:LoadAnimation(slash2)
animationTrack:Play();
cycle = 3
script.Parent.Enabled = false
animationTrack.Stopped:Wait()
script.Parent.Enabled = true
elseif cycle == 3 then
local animationTrack = hum:LoadAnimation(slash3)
animationTrack:Play()
cycle = 4
script.Parent.Enabled = false
animationTrack.Stopped:Wait()
script.Parent.Enabled = true
else
local animationTrack = hum:LoadAnimation(slash4)
animationTrack:Play()
cycle = 1
script.Parent.Enabled = false
animationTrack.Stopped:Wait()
script.Parent.Enabled = true
end
end)
script.Parent.Unequipped:Connect(function()
anim.run.RunAnim.AnimationId = organimrun
anim.walk.WalkAnim.AnimationId = organimrun
anim.idle.Animation1.AnimationId = organimidle
anim.idle.Animation2.AnimationId = organimidle
end)
Its just if you hold W,A,S, or D and equip the tool, it doesn’t switch to new animations. I’ve tried all I know, and digging the forums, but no avail.