hitCharacter not unanchoring upon hit

I’m trying to make a hammer that would unanchor anchored rootParts when it get hit.

local tool = script.Parent
local head = tool.Handle

local remoteEvent = tool.RemoteEvent

local smash

remoteEvent.OnServerEvent:Connect(function(player, character, charged, magnitude)
	local rootPart = character:FindFirstChild("HumanoidRootPart")
	
	if charged then
		smash = head.Touched:Connect(function(hit)
			local humanoid = hit.Parent:FindFirstChild("Humanoid")
			local hitCharacter = hit.Parent
			local hitRootPart = hitCharacter:FindFirstChild("HumanoidRootPart")
			
			if humanoid then
				local knockback = Instance.new("BodyVelocity")
				
				hitRootPart.Anchored = false --here fella!
				
				knockback.Parent = hitRootPart				
				knockback.Velocity = (rootPart.CFrame.LookVector * magnitude) + (rootPart.CFrame.UpVector * magnitude)
				knockback.MaxForce = knockback.MaxForce * magnitude
				wait()
				knockback:Destroy()
			end
		end)
		
		wait(0.3)
		smash:Disconnect()
	end
end)

Issue is, there are tests that it work and there are tests that it doesn’t. I’m really confused, please help me. Thanks much!

if hit:IsADescendantOf(hit.Parent) then return end

Add that somewhere ^
Also this could just be do to touch event whacking up. I don’t really understand the script, you don’t need to unanchor anything in the character to make them take knockback but whatever also 90% sure humanoidrootpart is always unanchored, if your testing on a dummy just make sure to unanchor all the parts.

yes. theres is a certain point in
the game where players would freeze (rootpart anchored) and i dont think theyll bounce back when hit if theyre anchored