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