How would I make a touched part push away the player in a certain direction

I have a wave ingame that when its hitbox is touched it ragdolls the player, but I want it to also push the player in the direction the wave is moving, I have no clue how to do that

Visual example:

(PD: I know in the video the model isn’t welded correctly but that’s not the issue i already fixed that)

help pls :sweat_smile:

Apparently BodyVelocity instances are deprecated so idk what to do

Use :ApplyImpulse. If you could show your code, I could write it for you.

For sure, here is the touched function in my code

(Wave is the tweening part)

local hitbox = wave.HitPart.Touched:Connect(function(hit)
		local char = hit.Parent
		if char:FindFirstChild("Humanoid") == nil then return end
		local plr = game:GetService("Players"):GetPlayerFromCharacter(char)
		
		if hitlist[char] == true then return end
		hitlist[char] = true
		
		
		-- Touch end
		
		local touchend = wave.HitPart.TouchEnded:Connect(function()
			print("done")
		end)
		
		-- Tsunami behaviour
		
		RagdollController.RagdollCharacter(char)
		
		
		task.wait(1)
		
		hitlist[char] = false
		touchend:Disconnect()
		
		
	end)

I added :ApplyImpulse.

Code:

local hitbox = wave.HitPart.Touched:Connect(function(hit)
	local char = hit.Parent
	if char:FindFirstChild("Humanoid") == nil then return end
	local plr = game:GetService("Players"):GetPlayerFromCharacter(char)

	if hitlist[char] == true then return end
	hitlist[char] = true


	-- Touch end

	local touchend = wave.HitPart.TouchEnded:Connect(function()
		print("done")
	end)

	-- Tsunami behaviour

	RagdollController.RagdollCharacter(char)
	char.HumanoidRootPart:ApplyImpulse(wave.HitPart.CFrame.LookVector * char.HumanoidRootPart.AssemblyMass)

	task.wait(1)

	hitlist[char] = false
	touchend:Disconnect()


end)

For some reason It is not working…

Does it need to be done from a localscript or something?

Yes it does, try using a remote event to fire the specific client and have it fling the player

LinearVelocity is the BodyVelocity equivalent. All of those objects got replaced with an equivalent when they were all deprecated.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.