VectorForce projectiles are delayed when cloned on the move

  1. What do you want to achieve? Have responsive rockets shoot straight out of a cannon.

  2. 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:

Rocket
–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
1 Like
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.

1 Like

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 ¯_ (ツ)_/¯

What I’d do is weld the projectile to the car or smth and then when it’s ready to shoot, break the weld and let the projectile go.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.