Invisible force pushing character after animation

There is a bug with my code and I have no idea what it could be.

After the animations finishes the player has a weird force that seems to attach itself most noticeably when jumping.

code (server):

note: setCutscene only disables movement and some other combat stuff

local function hit(hum)
			spawnChainsaw(char)
			
			local hrp = char.HumanoidRootPart
			local ehrp = hum.Parent.HumanoidRootPart
			
			initialTrack:Stop()
			local sound = chainSawInfo[char][5]:FindFirstChild("Crush" .. tostring(math.random(1,3)))
			sound = sound:Clone()
			sound.Parent = hum.Parent.HumanoidRootPart
			sound.PlayOnRemove = true
			sound:Destroy()
			_G.character.takeDamage(hum, 5)
			
			_G.character.setCutscene({char, hum.Parent}, true)
			
			hrp.Anchored = true
			ehrp.Anchored = true
			
			task.wait(.1)
			
			hrp.CFrame = CFrame.new(hrp.Position, Vector3.new(ehrp.Position.X,hrp.Position.Y,ehrp.Position.Z))
			ehrp.CFrame = char.HumanoidRootPart.CFrame * CFrame.new(0,0,-3) * CFrame.Angles(0,math.rad(180),0)
			local eanimator = hum:FindFirstChild("Animator") or Instance.new("Animator", hum)
			
			local bdTarget = eanimator:LoadAnimation(chainsawAnimations.Beatdown.HitTarget)
			local bdChar = animator:LoadAnimation(chainsawAnimations.Beatdown.HitChar)
			
			bdTarget:Play()
			bdChar:Play()
			
			bdChar.Stopped:Wait()
			if bdTarget.IsPlaying then
				bdTarget.Stopped:Wait()
			end
			
			_G.character.setCutscene({char, hum.Parent}, false)
			
			hrp.Anchored = false
			ehrp.Anchored = false
			
			task.wait()
			
			_G.Ragdoll.ragdoll(hum.Parent, 3)
			deleteChainsaw(char)
		end

I’ve already tried not anchoring the hrp and that didnt work

It affects both the target and the one doing the move.

When I change a property on the hrp in the console/explorer (local) during run time it fixes.

Idk what the bug is I need help

1 Like

Check your character in explorer after chainsawing the dummy. Are there any parts that don’t belong or aren’t connected to any body parts? That could be a reason.

I already checked there is nothing welded/in the part, only the default character parts.

Check “Massless” on the handle and every other part of your tool. That should do it.

It isn’t a tool but a part welded to the right arm and I checked if everything was massless and it is (the part gets deleted after along with the weld)

You did mention once you change a property in HRP on client side, it fixes. Maybe you could automate that with a localscript? Assuming the chainsaw script is server, you could use :FireClient() to get the local script to fire.

Idk what property you change but it could be minor like moving the hrp by 0.01 studs (Won’t affect rig and joints in a major way.

Weird. Maybe check what’s happening in the hierarchy of the player in explorer?

I did what you suggested yet it still does the same thing (Changing the same property I did during run time)

code:

local char = plr.Character
	if char then
		char.HumanoidRootPart.RootPriority = 1
		task.wait()
		char.HumanoidRootPart.RootPriority = 0
	end

did the same but changed anchor instead still doesnt work

What do you mean by this? I already checked the character and the players character property remains the same

I have a random feeling it has something to do with the dummy though. Do you mind trying to clone the dummy and delete the old one in the cutscene script? It seems weird but I feel like the dummy somehow is connected to the character. :thinking:
edit: I probably sound like an idiot right now

I tried it with another player in team test yet the same thing happened for both of us so I don’t think thats the case

1 Like

Wait, like both of you chainsawed or only one did the cutscene and bugged both of you?

I only did the move and we both got bugged.

1 Like

Okay, that’s just strange. So I’m assuming the dummy has a humanoid as it played an animation. Does it die after/during the cutscene?
(Edit again: I just realized he gets up after getting hacked by a chainsaw.)
Also could you try deleting the dummy like 3 seconds after its death to see if it fixes the issue?

Deleting him 3 seconds after still has the same issue

1 Like

Probably my last idea,
In the cutscene script, instead of doing hrp.CFrame or ehrp.CFrame, try using :SetPrimaryPartCFrame().
I don’t know if there’s a big difference but I know :SetPrimaryPartCFrame() moves all other parts in the model too.
So

hrp:SetPrimaryPartCFrame(CFrame_here)
ehrp:SetPrimaryPartCFrame(CFrame_here)

Because sometimes the humanoidrootpart can end up studs away from the main body while using position. Don’t know if it applies for CFrame too.

welp it doesn’t work gonna take a break and try again later thanks for the suggestions tho!

1 Like

I fixed the problem, when the animation is tweening back to the original position I unanchored before it fully returned causing a little offset in some weird part of the humanoidRootPart where you cant see and so it has a slight weird change. (at least thats what I think is happening)

So before I unanchor the root Part I wait until it fully tweens back

code (server):

local sound = chainSawInfo[char][5]:FindFirstChild("Crush" .. tostring(math.random(1,3)))
			sound = sound:Clone()
			sound.Parent = hum.Parent.HumanoidRootPart
			sound.PlayOnRemove = true
			sound:Destroy()
			_G.character.takeDamage(hum, 5)
			
			_G.character.setCutscene({char, hum.Parent}, true)
			--char.Humanoid.AutoRotate = false
			
			hrp.Anchored = true
			ehrp.Anchored = true
			
			local eanimator = hum:FindFirstChild("Animator") or Instance.new("Animator", hum)
			
			local bdTarget = eanimator:LoadAnimation(chainsawAnimations.Beatdown.HitTarget)
			local bdChar = animator:LoadAnimation(chainsawAnimations.Beatdown.HitChar)
			
			task.wait(.1)
			
			hrp.CFrame = CFrame.new(hrp.Position, Vector3.new(ehrp.Position.X,hrp.Position.Y,ehrp.Position.Z))
			ehrp.CFrame = char.HumanoidRootPart.CFrame * CFrame.new(0,0,-3) * CFrame.Angles(0,math.rad(180),0)
			
			bdTarget:Play()
			bdChar:Play()
			
			bdChar.Stopped:Wait()
			
			--char.Humanoid.AutoRotate = true
			_G.character.setCutscene({char, hum.Parent}, false)
			
			repeat -- //  THE PART THE WAITS FOR THE TORSO AND HRP TO ALIGN (Y AXIS IS ALWAYS DIFFERENT SO IT DOESNT CHECK) \\
				task.wait()
			until (hrp.Position.X == char.Torso.Position.X and hrp.Position.Z == char.Torso.Position.Z) and (ehrp.Position.X == hum.Parent.Torso.Position.X and ehrp.Position.Z == hum.Parent.Torso.Position.Z)
			task.wait(.2) -- .2 extra wait to be safe
			
			hrp.Anchored = false
			ehrp.Anchored = false
			
			hrp.CFrame = char.Torso.CFrame
			
			task.wait()
			
			--torment.Chainsaw.ResetProperty:FireClient(plr)
			
			_G.Ragdoll.ragdoll(hum.Parent, 3)
			deleteChainsaw(char)