Hello, I'm trying to script a fireball projectile that goes towards the mouse position, and everything works, just not as I intended it to work. For some reason the fireball doesn't go to the mouse position exactly, it is always a little off. I don't think anything other than this part of the script is necessary, but if there is anything else I could provide just tell me and I'll edit the question.
I already tried to change the line 11 and replace it for: FireballVelocity.Velocity = (Target - Fireball.Position).Unit * 50
(Target being the Mouse.hit.p ) but it didn't fix it either.
FireballInput.OnServerEvent:Connect(function(Player, Target)
local Character = Player.Character
local HumanoidRootPart = Character.HumanoidRootPart
local Fireball = ServerStorage.Fireball:Clone()
Fireball.Parent = workspace
Fireball.CFrame = HumanoidRootPart.CFrame * CFrame.new(0, 0, -5)
local FireballVelocity = Instance.new("BodyVelocity", Fireball)
FireballVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
FireballVelocity.Velocity = CFrame.new(HumanoidRootPart.Position, Target).lookVector * 50
Debris:AddItem(Fireball, 2)
end)
