Animation repeating itself after running into a wall

Set the animationtrack.Looped to false, in your system

3 Likes

I didn’t even know that, I thought the problem he had was normal thing.

3 Likes

I have already set it to false.

2 Likes

Could you show the script atleast?

2 Likes

I have edited my draft(broo, i hate this limit)

1 Like

It’s a normal thing.
But I think you could stop it by checking magnitude or smt I forget what it is.

if magnitude is too low or smt just don’t play anim

I don’t usually pro with magnitude thingy so yeah.

2 Likes

I dont really get what you mean, the magnitude of what exactly?

1 Like

could do something like this

1 Like

that really isnt my issue. I’m already using that in the script anyway and i already have a function that stops my character if i hit a wall. The problem is that the animation repeats itself while moving sideways while hitting the wall

1 Like

might just be your hitwall function thingy

1 Like

nah, this thing was the issue even before that function

1 Like

try detecting walking based on walkdirection

1 Like

you mean this: humanoid.MoveDirection.Magnitude?

1 Like

I personally prefer the non-stopping animation, the other one is glitchy and doesn’t look good

yes I am referring to that when it’s above 0 it means the human is walking

thats what im currently trying to fix

local function Movement()
	if humanoid.FloorMaterial ~= Enum.Material.Air or humanoid.FloorMaterial ~= Enum.Material.Water then
		if animTracks["Run"].isPlaying then
			animTracks["Walk"]:Stop()
		elseif animTracks["Walk"].isPlaying then
			animTracks["Run"]:Stop()

		end

		if humanoid.WalkSpeed <= 9 and humanoid.MoveDirection.Magnitude > 0 then
			animTracks["Run"]:Stop()
			animTracks["Walk"]:Play()

			if KeyDetection.pressed > 1 then
				local currentTime = tick()

				if lastPressedTime == nil then
					lastPressedTime = currentTime
				elseif currentTime - lastPressedTime < 0.5 then
					animTracks["Walk"].TimePosition = animationTrackStorage.Walk or 0
				elseif currentTime - lastPressedTime > 0.5 then	
					animTracks["Walk"].TimePosition = 0
				end

				lastPressedTime = currentTime
			end
		elseif humanoid.WalkSpeed > 9 and humanoid.MoveDirection.Magnitude > 0 then
			animTracks["Walk"]:Stop()
			animTracks["Run"]:Play()

			if KeyDetection.pressed > 1 then
				local currentTime = tick()

				if lastPressedTime == nil then
					lastPressedTime = currentTime
				elseif currentTime - lastPressedTime < 0.5 then
					animTracks["Run"].TimePosition = animationTrackStorage.Run or 0
				elseif currentTime - lastPressedTime > 0.5 then	
					animTracks["Run"].TimePosition = 0
				end

				lastPressedTime = currentTime
			end
		elseif humanoid.MoveDirection.Magnitude == 0 then
			animTracks["Walk"]:Stop()
			animTracks["Run"]:Stop()
			animTracks["Idle"]:Play()
		end
	end
end

i’m already checking for that when playing the anim

Oh really? By your title, it looks like you’re trying to stop repeating. I recommend you to change it to “Animation not repeating itself after running into a wall”

it is repeating but instead of being continous like the default roblox one, it just repeats itself from the start and it looks glitchy when you run into a wall

Ooooh, can’t really help you then, I’m not exactly a master at animation. Make sure you added a debounce variable!

1 Like