Cannonball doesn't launch from an explosion

Hi!

I am having issues with my cannon that i scripted. This is my first time making something like this, so I don’t really know why it’s not working.

I want my cannon to clone a cannonball, and shoot it using an explosion.

Below is my code:

local CannonBall = game.ReplicatedStorage.cannonball
local Cannon = script.Parent
local CannonballOrigin = script.Parent.Shoot
local ExplosionOrigin = script.Parent.Explode
local Shoot = Cannon.Wire.ClickDetector
local HasShot = false

-- configs

local DebounceTime = 3 
local BP = 50000




--Functions:


local function ShootBall()
	if HasShot == false then
		HasShot = true
		local Ammo = CannonBall:Clone()
		Ammo.Anchored = false
		Ammo.Position = CannonballOrigin.Position
		Ammo.Parent = game.Workspace
		local Explosion = Instance.new("Explosion")
		Explosion.Position = ExplosionOrigin.Position
		Explosion.BlastPressure = BP
		Explosion.BlastRadius = 60
		Explosion.DestroyJointRadiusPercent = 0
		Explosion.Parent = game.Workspace
		wait(DebounceTime)
		HasShot = false
	end
end



Shoot.MouseClick:Connect(ShootBall)

Instead of shooting the cannonball, it does this:

Thanks in advance!

1 Like

You need to use a body force or a body velocity, as the explosion force isn’t enough to propel the cannonball forward.

1 Like

First of all, maybe try delaying the explosion a bit if you want it to work, second of all, bodyvelocities and bodyforces work better with this.

You can use this instead
Modeling a projectile’s motion - Resources / Community Tutorials - DevForum | Roblox