I have an animation that will equip a bat and when the animation is done it just switches back to the original pose for the tool. If anyone has any idea on how to stop the animation when it’s about to end.
Things i’ve tried:
AdjustSpeed(0) – Doesn’t work
Get the length of the animation and set the position to the end – Doesn’t work
Here is some code I tried as well:
tool.Equipped:Connect(function()
local char = tool.Parent
local anim = script:WaitForChild("equip")
local hum = char.Humanoid
local equip = hum:LoadAnimation(anim)
equip:Play()
equip.Stopped:Connect(function()
task.spawn(function()
while task.wait() do
local endNum = 0.6499999761581421 -- this is the end of the animation length
equip.TimePosition = endNum
end
end)
end)
end)
tool.Equipped:Connect(function()
local char = tool.Parent
local anim = script:WaitForChild("equip")
local hum = char.Humanoid
local equip = hum:LoadAnimation(anim)
equip:Play()
equip.Stopped:Connect(function()
equip:AdjustSpeed(0)
end)
end)