Battering Ram gets buggy after 3-4 uses

The first 3 or so times you hit the button, everything works perfectly. After that, however, things get weird. I’m not sure what’s responsible for this problem (maybe the rope constraints?), but here’s a video of the problem if you think you can help:

local function ram_strike()
	if cooldown == false then
		cooldown = true
		TweenService:Create(part, ChargeInfo, {CFrame = part.CFrame * CFrame.new(7,1.5,0)}):play()
		wait(1.4) -- Tween 1 duration
		TweenService:Create(part, SwingInfo, {CFrame = part.CFrame * CFrame.new(-9,0,0)}):play()
		wait(3) -- Tween 2 duration
		wait(2) -- Extra delay
		cooldown = false
	end
end

I also checked multiple times to make sure the ram wasn’t getting caught on anything and that all the parts that would collide with it have CanCollide disabled

You could try creating the two tweens outside of the function and using them inside the function (so that you aren’t constantly creating new tweens).

(Also use task.wait() instead of wait() because it’s the updated version.)

1 Like

They need to be defined inside the function or else the CFrame gets messed up, but thanks for the ‘wait’ tip

1 Like

This is out of left field, but if the ram isn’t completely stopping all motion before you hit the ram button again, won’t it pull the cframe from a moving part, and maybe cause this issue? have you tried letting it completely stop before doing it again?

1 Like

Good idea, I’ll try it out


1 Like

I only say this since I use rope constraints and they take quite some time to completely stop, unless the restitution is on 0.

1 Like

Unfortunately this did not work, but I did find out that the bug always occurs on the third time

I’ll try playing with the retention and seeing what happens

1 Like

Did you mean restitution?


lol i just changed my post, yes

1 Like

I got the same issue unfortunately, even after setting all of them to 1

This is also prob off topic, but i notice in the video the back rear wheel is moving off its orientation… is this also supposed to be happening? Just seeing if its all related, or if its a tween issue.

1 Like

I was also playing around with the wheels, the problem occurs with/without them enabled. Thanks for telling me though.

Ok, it reminded me of another post where someones train did the same jittery effect and i believe they had two hinge constraints working against each other.

1 Like

Have you tried to play with the wait durations… maybe try 4 for the tween duration and 3 for the extra delay?

1 Like

Maybe this post might help stop the tween once it finishes:
https://devforum.roblox.com/t/how-can-i-stop-my-tween/438464

1 Like

I don’t think it’s that but I’ll try removing joints and seeing what happens

1 Like

I’ll try this too, thanks


1 Like

Unfortunately these both yielded the same result, I’m going to try making a third tween so that it doesn’t rely on the “snap” of the rope constraints to send the ram back to its original position