What do you want to achieve? Have responsive rockets shoot straight out of a cannon.
What is the issue? VectorForce projectiles look odd. Roblox 2022 09 29 12 39 28 - YouTube
I’ve been stuck with this problem for a few days now and would be very grateful if anyone could give me any directions!
Below you can see the code thats used:
–Float fights the gravity
–Force just moves the part forward
while true do
local Rocket = game.ReplicatedStorage.CannonRocket:Clone() --Clone rocket
Rocket.PrimaryPart.CFrame = game.Workspace.Car.Cannon.CFrame + Vector3.new(0,0.25,0) --Move it to position
Rocket.Parent = game.Workspace
Rocket.PrimaryPart:SetNetworkOwner(nil)
wait(1)
end
while true do
local Rocket = game.ReplicatedStorage.CannonRocket:Clone() --Clone rocket
Rocket.PrimaryPart.CFrame = game.Workspace.Car.Cannon.CFrame + Vector3.new(0,0.25,0) --Move it to position
Rocket.AssemblyLinearVelocity = game.Workspace.Car.Cannon.AssemblyLinearVelocity
Rocket.Parent = game.Workspace
Rocket.PrimaryPart:SetNetworkOwner(nil)
wait(1)
end
It’s not spawning at the cannon because it doesn’t have the same velocity as the car, thus meaning the car will move ahead of it before the rocket can get up to speed.
You can fix this by setting the AssemblyLinearVelocity of the rocket to be the same as that of the cannon.
That way, the rocket spawns with the same velocity as the car and doesn’t get left behind.
Also, a side note: wait() is deprecated and can cause performance issues, I personally would advise using task.wait() instead.
Thank you! Your solution still isn’t ideal but it sure made the whole situation better. Car is controlled by localscript and projectiles are created by server so that might also cause some delay ¯_ (ツ)_/¯