I want to figure out how to deal knockback on a player but similar to Slap Battles’ knockback system. I’ve been looking around for solutions, however nothing works I tried using BodyVelocity but it still didn’t work and I don’t understand how to make the properties work so it makes the character experience knockback.
You’re most likely using R6. If you want to implement a ragdoll system consider this one: Ragdoll 5.2.rbxm (7.8 KB)
I made a game similar to this one and I used a temporary LinearVelocity object that was destroyed 0.2 seconds later. The only issue with LinearVelocity is that it doesn’t replicate the physics immediately, so you will need to implement a system that counteracts this issue or use BodyVelocity.
local glove = script.Parent.Parent.Glove
local hand = script.Parent.Hand
local slap = script.Parent.Slap
local playerslapped = game.ReplicatedStorage:WaitForChild("PlayerSlapped")
playerslapped.OnServerEvent:Connect(function(player, targetedplayer, humanoid, locatedhead)
slap:Play()
local targetHumanoid = targetedplayer:WaitForChild("HumanoidRootPart")
local playerHumanoid = player.Character:WaitForChild("HumanoidRootPart")
if targetHumanoid and playerHumanoid then
for _, v in pairs(targetedplayer:GetDescendants()) do
if v:IsA("Motor6D") then
local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
a0.CFrame = v.C0
a1.CFrame = v.C1
a0.Parent = v.Part0
a1.Parent = v.Part1
v.Part0.CanCollide = true
v.Part1.CanCollide = true
local b = Instance.new("BallSocketConstraint")
b.Attachment0 = a0
b.Attachment1 = a1
b.Parent = v.Part0
v.Enabled = false
end
end
local force = Instance.new("LinearVelocity", targetHumanoid)
force.MaxForce = Vector3.new(2,1.5,2) * math.huge
local direction = (targetHumanoid.CFrame.Position - playerHumanoid.CFrame.Position).Unit
force.VectorVelocity = (direction + Vector3.new(0,0.5,0)).Unit * 25
local rotation = Instance.new("BodyAngularVelocity",targetHumanoid)
rotation.AngularVelocity = Vector3.new(1,0.7,1) * math.pi * math.random(1.9,2.9)
rotation.MaxTorque = Vector3.new(1.5,1.5,1.5) * math.huge
rotation.P = 3600
wait(0.35)
end
targetedplayer.HumanoidRootPart.CanCollide = false
end)