Tree Animation Script Plays but to fast. how to fix?s

So i have this issue where my script needs to play a animation for tree falling, it does that but within a milisecond. and i do not know how to fix it. anybody know how to fix?
here is my code:

local label = script.Parent.Parent.HealthPart.Health
local treeStem = script.Parent
local swingsLeft = 10
local animation = script:WaitForChild("Dance2")
local humanoid = script.Parent.Parent:WaitForChild("Humanoid")
local dance = humanoid:LoadAnimation(animation)
local animation2 = script:WaitForChild("Fall")
local animationFall = humanoid.Animator2
local FallDance = humanoid:LoadAnimation(animation2)


local function onTouch(otherPart)
	local tool = otherPart.Parent
	if tool:IsA('Tool') and tool.Hitting.Value == true and otherPart.Parent.Name == "Axe" then
		swingsLeft -= 1
		label.GreenHealth.Size = UDim2.new(swingsLeft/10, 0, 1, 0)
		dance:Play()
		dance.Looped = false
		
	else
		if otherPart.Parent.Name == not "Axe" then
			return nil
		end
	end
	if swingsLeft <= 0 then
		if script.Parent.Parent:FindFirstChild("Leaves") then
			FallDance:Play()
			FallDance.Looped = false
			if FallDance.Ended then
				script.Parent.Parent.Leaves:Destroy()
				
				script.Parent.Parent.HealthPart.Health.Enabled = false
				if script.Parent.Parent.TreeStem2.ProximityPrompt.Enabled == false then

					script.Parent.Parent.TreeStem2.ProximityPrompt.Enabled = true
					script.Parent.Parent.TreeStem2.Anchored = false
					script.Parent.Parent.TreeStem:Destroy()
					script.Parent.Parent.HealthPart:Destroy()
					script.Parent.Parent.HumanoidRootPart:Destroy()
			end

			end

			

		end
	end
end

treeStem.Touched:Connect(onTouch)

I believe there is a method on the animation which is :AdjustSpeed() that allows you to change the speed at which the animation is played at.

1 Like

Yeah i did it now but now it infinitly loops, while loop is off and in the animation editor i put loop to false.

I can’t remember what it is called on the top of my head, for the animation itself, in the animator editor could you not move the animation points along further so that it plays longer.

My bad! i accidently put a event with a dot not a :
For example:
Animation.Stop() while i needed Animation:Stop()
and your :adjustspeed() worked!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.