Missile Physics Client/Server Difference Issue

Hello!

I seem to have a Physics issue where the client perspective is different from the server perspective.

A short explanation of how the system works.

A UI Button is pressed, which is connected to a RemoteEvent which fires this code:
(MissileList is just a table of all the Missiles, Target is the target)
(The Coroutine function is just for controlling the Silo, it has nothing to do with the actual missile.)

MissileFramework

local function FireMissiles(Player, MissileList, Target)
	for indexMissile, Missile in pairs(MissileList) do
		if Missile.CriticalStructure.Engineering.Silo.Value:GetAttribute('Open') == true and Missile.CriticalStructure.Engineering.Silo.Value:GetAttribute('InOperation') == false and Missile:GetAttribute('InFlight') == false then
			wait(0.5)
			Missile.Parent = workspace
			Missile.Tracker.Motor6D:Destroy()
			Missile.PrimaryPart:SetNetworkOwner(nil)
			Missile.CriticalStructure.Code.Start.Disabled = false
			Missile.CriticalStructure.Engineering.Target.Value = Target
			Missile:SetAttribute('InFlight', true)
			Events.Armament.ConfirmedFireMissile:FireClient(Player, Missile)

			coroutine.resume(coroutine.create(function()
				wait(1.5)
				SiloControl(Missile.CriticalStructure.Engineering.Silo.Value, false)
			end))
		end

		--Warhead sstuff will go here later
	end
end

In this code, the Start ServerScript within the Missile is enabled:

Start

local Missile = script.Parent.Parent.Parent


Missile.Tracker.Anchored = false
Missile.Thruster.AssemblyLinearVelocity = Missile.Thruster.CFrame:VectorToObjectSpace(Vector3.new(0, 0, 230))
Missile.Tracker.AlignOrientation.Enabled = true


wait(1.5)
for _,Obj in pairs(Missile:GetDescendants()) do
	if Obj.Name == 'Thrust' then
		Obj.ParticleEmitter.Enabled = true
	end
end

Missile.CriticalStructure.Code.Flight.Disabled = false

Missile.Thruster.LinearVelocity.Enabled = true


script.Disabled = true

In this code, the Missile is “Launched” into the air, then AlignOrientation and LinearVelocity is enabled.
The script then enables the Flight ServerScript which is also in the Missile, then disables itself.

Flight

local Missile = script.Parent.Parent.Parent

local VelocityCounter = 700
local TrackerCounter = 0

while true do
	
	Missile.Tracker.AlignOrientation.CFrame = CFrame.new(Missile.Tracker.Position, Vector3.new(Missile.CriticalStructure.Engineering.Target.Value:GetPivot().X, Missile.CriticalStructure.Engineering.Target.Value:GetPivot().Y, Missile.CriticalStructure.Engineering.Target.Value:GetPivot().Z))

	
	wait(1)
end

In this code, it simply keeps the AlignOrientation oriented towards the target.

Video from the CLIENT perspective:

Vide from the SERVER perspective:

As you can see in the differences, the Server Perspective is alot smoother, while in the ClientPerspective the missile simply stops a moment as if anchored then continues on its path.
I’ve attempted to fix by simply not setting the NetworkOwnership to the server and keeping it to the client, but the same problem persists.

Any help is appreciated.

Thanks!

Try looking at BufferModule. Problem seems similar.

1 Like

It’s similar yes, but would it be applicable in this case? I’m not creating a new missile model, the missile model is already welded to the Starship as soon as the Server opens, long before anyone interacts with it.
Can it be that since when a player is sits in the Missile Control seat the NetworkOwnership is not set to that player? (I’m reserving it for one who controls the movement of the Starship)
I should probably look into that.