So i have this combat system for my game that involves melee knockback, everything works perfectly until i kill the enemy and blud gets launched back like an anime character. Whats the best way to fix this?
heres the code to the melee weapon
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RaycastHitbox = require(ReplicatedStorage.RaycastHitboxV4)
local collectionService= game:GetService("CollectionService")
local newHitbox = RaycastHitbox.new(script.Parent)
newHitbox.Visualizer = false
script.Parent.Attack.OnServerEvent:Connect(function(p, lookVector)
newHitbox:HitStart()
newHitbox.OnHit:Connect(function(hit, humanoid)
if humanoid.Parent:HasTag("Enemy") then
local walkspeed = humanoid.WalkSpeed
humanoid:TakeDamage(30)
humanoid.WalkSpeed = 0
humanoid.Parent.HumanoidRootPart.Velocity = lookVector*100
script.Parent.Damage1:Play()
wait(0.2)
humanoid.WalkSpeed = walkspeed
end
end)
wait(0.3)
newHitbox:HitStop()
end)