I’m making an explosion where it’ll fling the player by changing the HumanoidRootPart
’s Velocity
which seems to work great when the player is already in the air, but when the player is on the floor and gets hit by the explosion they only move about a centimeter. How would I go about fixing this?
Code:
local explosion = Instance.new("Explosion")
explosion.Position = script.Parent.Position
explosion.DestroyJointRadiusPercent = 0
explosion.ExplosionType = Enum.ExplosionType.NoCraters
explosion.BlastPressure = 500000;
explosion.BlastRadius = 100
explosion.Parent = script.Parent
local hit_targets = {}
explosion.Hit:Connect(function(part)
if part.Parent:FindFirstChild("Humanoid") then
local char_model = part.Parent
if char_model and not hit_targets[char_model] then
hit_targets[char_model] = true
local directionVector = (char_model.HumanoidRootPart.CFrame.p - explosion.Position).unit
local velocity = directionVector * 500
char_model.HumanoidRootPart.Velocity = velocity
end
end
end)
Video example: