Hello. I was working on this knockback system but then I couldn’t delete the body velocity properly, after adding some print statements nothing below task.wait(1) doesnt seem to work.
it prints everything, but the ragdols and knockback happen so quickly i cant see it. there is a little 0.0001 seconds of freeze though, probably indicating that it happened too quickly
local r6Module = require(game:GetService('ServerScriptService').R6Ragdoll.ModuleScript)
local animation = game:GetService('ReplicatedStorage').animation
local stage = 4
local debris = game.Debris
script.Parent.deal.Changed:Connect(function(player)
script.Parent.Touched:Connect(function(hit)
if hit.Name ~= 'Torso' then
return
end
if hit.Parent.Humanoid and game.Players:GetPlayerFromCharacter(hit.Parent) then
local char = hit.Parent
if script.attacker.Value == char.Name then
print('self attac')
end
if char.hitAlready.Value == true then
return
end
char.hitAlready.Value = true
char.Humanoid:TakeDamage(10)
if stage == 4 then
local kb = Instance.new('BodyVelocity')
kb.Parent = char.HumanoidRootPart
kb.MaxForce = Vector3.new(300000,300000, 300000)
kb.Velocity = game.Workspace[script.attacker.Value].HumanoidRootPart.CFrame.LookVector * 100
if char.RagdollTrigger then
char.RagdollTrigger.Value = true
print('ragdolled, waiting now')
print('waited')
char.RagdollTrigger.Value = false
else
print('no ragdoll trigger')
r6Module:Setup(char)
r6Module:Unragdoll(char)
end
print('no more if statement')
char.HumanoidRootPart.BodyVelocity:Destroy()
end
print('no more')
if stage ~= 4 then
local anim = animation.stages[stage]
char.Humanoid:LoadAnimation(anim):Play()
end
char.hitAlready.Value = false
end
end)
end)
i dont think there is any problems here. i mean it already got to the ragdolled,waiting now. i also start flying while being knocked down towards the direction i was facing… sooo
Hey. I just realized that i had put a script in the hitbox that would delete itself if it’s parent is changed to workspace. while deleteing the older scripts
This completely slipped my mind as I made it a while ago, and only just decided to work on this projcet with my friend. i will make your answer the solutuon, thanks for taking your time to help me out.