Cant Stop Animation

Hello, my problem is


UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.C then
		local player = game.Players.LocalPlayer
		local character = player.Character or player.CharacterAdded:Wait()
		local humanoid = character:FindFirstChildOfClass("Humanoid")

		local animation = Instance.new("Animation")
		animation.AnimationId = "rbxassetid://18144033389"
		local animationTrack = humanoid:LoadAnimation(animation)



		if not animationTrack.IsPlaying then
			animationTrack:Play()
			animationTrack:GetMarkerReachedSignal("END"):Connect(function()
				animationTrack:AdjustSpeed(0.0000001)
				print("Animation Frozen!")
			end)
		else
			animationTrack:AdjustSpeed(1)
			animationTrack:Stop()
		end
	end		
end)

that this code doesnt stop animation, when I press C, it just plays animation, stops it, and when I press C again it just does same thing, any ideas how to fix it? thank you

2 Likes

#help-and-feedback
Wrong catagory

2 Likes