The knock back on my moves seem to only really work when i face one direction
here is my ragdoll module function i made
function ragdollmodule.ragdoll(plr, guytoragdoll, vec3)
guytoragdoll:SetAttribute("Ragdolled", true)
local hrp = guytoragdoll:FindFirstChild("HumanoidRootPart")
local huma = guytoragdoll:FindFirstChild("Humanoid")
local plrhrp = plr:FindFirstChild("HumanoidRootPart")
hrp:SetNetworkOwner(nil)
for _, joint in pairs(guytoragdoll:GetDescendants()) do
if joint:IsA("Motor6D") then
local socket = Instance.new("BallSocketConstraint", joint.Parent)
local att1 = Instance.new("Attachment", joint.Part1)
local att0 = Instance.new("Attachment", joint.Part0)
huma.PlatformStand = true
att0.Name = "att"
att1.Name = "att"
att0.CFrame = joint.C0
att1.CFrame = joint.C1
socket.Attachment0 = att0
socket.Attachment1 = att1
socket.TwistLimitsEnabled = true
socket.LimitsEnabled = true
joint.Enabled = false
huma:ChangeState(Enum.HumanoidStateType.Physics)
hrp.AssemblyLinearVelocity = plrhrp.CFrame * vec3
end
end
task.spawn(function()
task.wait(2.5)
guytoragdoll:SetAttribute("Ragdolled", false)
huma.PlatformStand = false
huma:ChangeState(Enum.HumanoidStateType.GettingUp)
for _, joint in pairs(guytoragdoll:GetDescendants()) do
if joint:IsA("Motor6D") then
joint.Enabled = true
elseif joint:IsA("BallSocketConstrait") or joint:IsA("att") then
joint:Destroy()
end
end
end)
end
this is how i used the module script in my m1 script
When you set the AssemblyLinearVelocity, it expects a vector in object(local) space. If you set it to Vector3.new(0, 200, 0), a part would go straight up into the air. Currently, you are taking a cframe and multiplying it by a vector3, which would return a position 200 studs in front of where the player is currently standing. I would recommend creating a vector from the player to the NPC, and then applying that directly. I would also avoid updating the Humanoid and HumanoidRootPart for each join. When you parent the attachments to the parts of the joint, they aren’t deleted, and would pile up, so I cleaned that up as well:
function ragdollmodule.ragdoll(plr, guytoragdoll, power:number)
guytoragdoll:SetAttribute("Ragdolled", true)
local hrp = guytoragdoll:FindFirstChild("HumanoidRootPart")
local huma = guytoragdoll:FindFirstChild("Humanoid")
local plrhrp = plr:FindFirstChild("HumanoidRootPart")
hrp:SetNetworkOwner(nil)
for _, joint in pairs(guytoragdoll:GetDescendants()) do
if joint:IsA("Motor6D") then
local socket = Instance.new("BallSocketConstraint")
local att1 = Instance.new("Attachment", socket)
local att0 = Instance.new("Attachment", socket)
huma.PlatformStand = true
att0.Name = "att"
att1.Name = "att"
att0.CFrame = joint.C0
att1.CFrame = joint.C1
socket.Attachment0 = att0
socket.Attachment1 = att1
socket.TwistLimitsEnabled = true
socket.LimitsEnabled = true
socket.Parent = joint.Parent
joint.Enabled = false
end
end
huma:ChangeState(Enum.HumanoidStateType.Physics)
local direction = (hrp.Position-plrhrp.Position).Unit
hrp.AssemblyLinearVelocity = direction * power
task.delay( 2.5, function()
guytoragdoll:SetAttribute("Ragdolled", false)
huma.PlatformStand = false
huma:ChangeState(Enum.HumanoidStateType.GettingUp)
for _, joint in pairs(guytoragdoll:GetDescendants()) do
if joint:IsA("Motor6D") then
joint.Enabled = true
elseif joint:IsA("BallSocketConstrait") or joint:IsA("att") then
joint:Destroy()
end
end
end)
end
ragdollmodule.ragdoll(plrchar, guytodmg, 200)
Hope this helps! If anything doesn’t work, or if there’s anything you don’t understand, let me know.