I'm trying to make a handcannon, which is a literal handheld cannon, fire cannon balls every time the left mouse button is clicked. I tried adding an invisible and unable-to-collide-with sphere inside the cannon and made it to where a clone with a body velocity in it would appear when you clicked.
I quickly realized the body velocity does not move the object relative to the handle's local orientation, but in one constant direction. I want to be able to look left, right, up, down and shoot the cannon ball in that direction. Also, the tool is only intended to be used on objects and not other players.
Can anybody help me with this?
(here is the script below)
local sph = script.Parent.Handle script.Parent.Activated:Connect(function() local c = sph:Clone() c.Name = "CannonBall" c.Parent = game.Workspace local bv = Instance.new("BodyVelocity") bv.Velocity = Vector3.new(0,0,1000) bv.Parent = c c.Anchored = false c.Transparency = 0 c.CanCollide = true end)