So, I made a banana projectile. I want to launch it at my target.
The issue is that right before it launches, it waits for about 0.1 seconds and then launches making it very inaccurate and it just looks laggy.
local Assets = RS.Assets
local Banana = Assets.Projectiles.Banana
local function ShootBanana(Chicken, ShootCycle)
local NewBanana = Banana:Clone()
NewBanana.Name = "Banana"..ShootCycle
NewBanana.CFrame = Chicken.HumanoidRootPart:FindFirstChild("eye"..ShootCycle).CFrame
NewBanana.Parent = Chicken.Bullets
local Values = Chicken.Values
local Target = Values.FoundTarget.Value
local Power = Values.Power.Value
local direction = (Target.HumanoidRootPart.Position - NewBanana.Position).unit
local bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.MaxForce = Vector3.new(100000, 100000, 100000)
bodyVelocity.Velocity = direction * Power
bodyVelocity.Parent = NewBanana
task.delay(5, function()
NewBanana:Destroy()
end)
end
I tried giving the velocity before the spawning but that also did not work.
The banana is launched at the target but first it is stuck for 0.1 seconds.