Help on how to throw player away

So, im making a customized AI, and currently it has 2 attacks, and one of the attacks the monster grabs the player then throws him away dealing damage, how i would make the monster throw him away to the direction the monster is (like move it 75 studs away from the monster in the directiong the monster is looking)

Heres the part of the script i want to do that


local grabanim = script.Parent.Animations.Grab
local _grabanim = script.Parent.ZombieNoid:LoadAnimation(grabanim)
local grabattackanim = script.Parent.Animations.GrabAttack
local _grabattackanim = script.Parent.ZombieNoid:LoadAnimation(grabattackanim)
local grab = script.Parent["Left Arm"].GrabPart.Position
local enemy = p.Parent
local enemyhuman = getHumanoid(enemy)
enemyhuman.WalkSpeed = 0
_grabanim:Play()
enemyhuman.Parent.HumanoidRootPart.Position = grab
enemyhuman.Parent.HumanoidRootPart.Anchored = true
wait(0.2)
enemyhuman:TakeDamage(ZombieDamage)
wait(1)
MasterDebounce = false
3 Likes

Use a BodyPosition instance to move the player in the opposite direction of the enemy.

1 Like

When i need to throw some part i use AsseblyLinearVelocity, ill write a example of how you could throw a character

local VictimCharacter = TheCharacterHere
local Humanoid = VictimCharacter:FindFirstChildOfClass("Humanoid")
local RootPart = VictimCharacter:FindFirstChild("HumanoidRootPart") or Humanoid.RootPart

-- I use this method, so if the HumanoidRootPart is renamed it will still find it
 
--Humanoid.PlatformStand = true
Humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, true)
-- you need to "ungrip" the humanoid from the current floor
-- or the engine somewhat ignores the new velocity
-- If you have a problem with this setstate
-- try the Enum.HumanoidStateType.Ragdoll Enum or the platform stand
RootPart.AssemblyLinearVelocity = Vector3.new(0,100,100)
--Humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
--Humanoid.PlatformStand = false


-- Since the enum is FallingDown i don't think we need to set it to false back
-- Enum lists https://developer.roblox.com/en-us/api-reference/enum/HumanoidStateType

Edits:
it is more about what options you can use, so find what is better for your application
I wont be doing the vector math for you but you can try to subtract the current vector from target, get it’s unit and multiply by 100

1 Like

Oh yeah this helped ne quite a lot! thx

3 Likes