Converting wallstick script to r6

How would I convert this script to r6? I need this script for my game, and I’ve tried replacing LowerTorso.Root with HRP.RootJoint, but it turns out wierd – plug the linked script into StarterCharacterScripts to see what I mean. Anyone else having the same problem or trying to fix something like this or is this just a bug?

To be absolutely clear, what I’m trying to accomplish is having this script happen for a short while after stepping on a part, like in this video (at the 1:20 and 1:11 timestamps):