local Humanoid = script.Parent:WaitForChild("Humanoid")
local Ragdoll = require(game:GetService("ServerScriptService").Hit.RagdollModule)
local Knockback = require(game:GetService("ServerScriptService").Hit.KnockbackModule)
local Table = {}
Humanoid.Touched:Connect(function(Hit)
if table.find(Table,script.Parent) then return end
local Bool = Hit:FindFirstChild("HIT_")
if Bool ~= nil and Bool.Value == true then
table.insert(Table, script.Parent)
Ragdoll.Start(script.Parent)
Knockback.Start(script.Parent, (script.Parent.HumanoidRootPart.Position - Hit.Position).Unit * Vector3.new(200,0,200) + Vector3.new(0,100,0))
task.wait(5)
table.remove(Table,script.Parent)
Ragdoll.Stop(script.Parent)
end
end)
local knockback = {}
function knockback:Start(Character, direction)
local HRP = Character:FindFirstChild("HumanoidRootPart")
if HRP == nil then return end
local Attachment = Instance.new("Attachment")
Attachment.Parent = HRP
local LinearVelocity = Instance.new("LinearVelocity")
LinearVelocity.Parent = Attachment
LinearVelocity.MaxForce = 9999999
LinearVelocity.VectorVelocity = direction
LinearVelocity.Attachment0 = Attachment
game:GetService("Debris"):AddItem(Attachment,0.1)
end
return knockback
this line is causing a error that i dont know how to fix.
local HRP = Character:FindFirstChild("HumanoidRootPart")