KnockBack System

nothing happens :frowning:

function module.Knockback(plr_who_swung, hit, part)
	if hit.Parent:FindFirstChild("Humanoid") then
		local char = hit.Parent
		local HRP = char:FindFirstChild("HumanoidRootPart")

		if HRP then 
			local lv = plr_who_swung.Character.HumanoidRootPart.CFrame.LookVector
			local LV = char:FindFirstChild("HumanoidRootPart").CFrame.LookVector * lv 

			local Speed = 70000 

			HRP:SetNetworkOwner(nil)

			local vF = Instance.new("VectorForce")
			vF.RelativeTo ="Attachment0"
			vF.Attachment0 = HRP:FindFirstChildWhichIsA("Attachment")
			vF.ApplyAtCenterOfMass = true
			vF.Force = LV*Speed
			vF.Parent = HRP

			wait(.15)

			vF:Destroy()
			HRP:SetNetworkOwner(plr_who_swung)
		end
	end
end

movechar.rbxl (34.9 KB)
Seems to work here

when running game type

game.ReplicatedStorage.Re:FireServer()

into the CommandBar
image

It just flings me really really far off the map
and in the wrong direction

Well yes the vector3 value is just the direction the player is heading, as i do not have 2 players in this game. Its just proof of concept

Okay back from class and typing on a phone.
I’m assuming the script is in the bat or hitbox:
Here’s a simpler script

local function FuncName()
local hum = part.Parent:FindFirstChild(“Humanoid”)
if hum then
local char = path_victim_char_here
local plrchar = path_hitter_char_here

if char then
local velo = Instance.new(“BodyVelocity”)
velo.Maxforce = Vector3.new(x,y,z)
velo.P = 2000
velo.Parent = char.HumanoidRootPart

velo.Velocity = plrchar.HumanoidRootPart.CFrame.LookVector*multi_here
velo.Velocity += Vector3.new(0,5,0)
task.wait(0.2) 
velo.Velocity = Vector3.new(0,0,0)
velo:Destroy()
end
end
end

Might’ve made a typo or two but you can try this very simple script to see if it made any difference. Try setting multi to like 5000 to see if the dummy moved at all.

you didnt parent the velo instance

1 Like

Oops my bad lol.
I’ll edit it real quick