So basically, I have this item in my game called “Knockback Blaster” and to put it simply, you charge it, it fires, does some damage and sends the enemy flying. Now initially this seemed to work with flying colors, until I play tested my game with a friend and found out that there was a obscure bug with this. It turns out, it seemed like tweening the position of the humanoidrootpart to move the whole character was more of an illusion, as other items that position relative to certain parts of the character broke. I have a video below showing this, first showing the knockback blaster, and then showing an example tool, and then getting hit by the knockback blaster, and then finally showing what happens with that same tool after.
I have tried multiple ways to fix this, even attempting to tween the torso or the whole character but that didn’t work. From here, my only possible idea is using something else other than the tween service but I don’t really know how to use stuff like body velocity, and if I did I’m not sure how I would replicate what the tweenservice made the knockback look like. So now I just find myself at the original code with the same issue.
Here is the said code that does the tweening (ignore the commented out platformstand those were another attempt to fix the problem)
function damagePlayers(damage, target, player, chargePercent)
if chargePercent == nil then
local vHumanoid = target.Parent:FindFirstChild("Humanoid")
DamageHandler.InflictDamage(vHumanoid,player,damage)
--vHumanoid.PlatformStand = true
local hitTween = TweenService:Create(target.Parent:FindFirstChild("HumanoidRootPart"), hitTweenInfo, {Position = target.Parent:FindFirstChild("HumanoidRootPart").Position + (player.Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * Vector3.new(10,10,10))})
hitTween:Play()
hitTween.Completed:Wait()
--vHumanoid.PlatformStand = false
else
if (chargePercent / 5) < 1 then
local vHumanoid = target.Parent:FindFirstChild("Humanoid")
DamageHandler.InflictDamage(vHumanoid,player,damage)
--vHumanoid.PlatformStand = true
local hitTween = TweenService:Create(target.Parent:FindFirstChild("HumanoidRootPart"), hitTweenInfo, {Position = target.Parent:FindFirstChild("HumanoidRootPart").Position + (player.Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * Vector3.new(10,10,10))})
hitTween:Play()
hitTween.Completed:Wait()
--vHumanoid.PlatformStand = false
else
local vHumanoid = target.Parent:FindFirstChild("Humanoid")
DamageHandler.InflictDamage(vHumanoid,player,chargePercent / 5)
--vHumanoid.PlatformStand = true
local hitTween = TweenService:Create(target.Parent:FindFirstChild("HumanoidRootPart"), hitTweenInfo, {Position = target.Parent:FindFirstChild("HumanoidRootPart").Position + (player.Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * Vector3.new(chargePercent,chargePercent,chargePercent))})
hitTween:Play()
hitTween.Completed:Wait()
--vHumanoid.PlatformStand = false
end
end
--DamageCounter:FireClient(player,damage)
end
Any help or tips are appreciated.