Fireball affected by gravity

Hi everyone,

I’m trying to create a simple Fireball that moves towards my cursor’s location. Unfortunately, I’m having some problems with that. Whenever I release the fireball it doesn’t go to where my cursor is pointed, while it is moving it starts to go downwards from the cursor location. This is most likely because of gravity affecting it so I decided to add a BodyForce (After some research) which would counter the gravity on the fireball. I tried this and it still has the same effect, can someone help out?

Code:

	local sphere = templateFolder.Sphere:Clone()
	sphere.Name = player.Name.."'s Sphere"
	sphere.CFrame = humanoidRootPart.CFrame * CFrame.new(0,1,-1)
	sphere.Parent = effectsFolder
	
	local bodyVelocity = Instance.new("BodyVelocity")
	bodyVelocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
	bodyVelocity.Velocity = mouseCFrame.LookVector * projectileSpeed
	bodyVelocity.Parent = sphere
	
	local bodyForce = Instance.new("BodyForce")
	bodyForce.Force = Vector3.new(0,workspace.Gravity,0) * sphere:GetMass()
	bodyForce.Parent = sphere	

I don’t really work with these stuff often or before, but you could try

mouse.Hit.p.Unit

instead of lookVector if that even makes a difference.

Have you tried making the fireball Massless, or maybe the one above, something like:

(endpoint-startpoint).Unit or CFrame.new(start, lookat).LookVector

?

It seems the gravity has less effect on the fireball but its direction is messed up.

I just tried your suggestions, still doesn’t seem to work.

Well I ended up messing with some things and it works perfectly now.

can you please send the working code. TY

i edited the code and ended up working. i changed the mouseCFrame.LookVector * projectileSpeed to mouse.Hit.Position * 10