Physics hanging

Writing a system for powerups using roblox physics for the projectiles and encountered this hanging of the physics sim, this needs to be instantaneously. And yes, it has to be on the server since these are global.


Video of the issue

local Vehicle = player.LinkedVehicle
		local Weight = Vehicle.Body:FindFirstChild("#Weight")
		local Bolt = ServerStorage.PhysicalPowerup.Bolt:Clone()
		local Ang, Lin = Instance.new("AngularVelocity"), Instance.new("LinearVelocity")
		-- z ang, x lin
		Ang.Parent = Bolt.Main; Lin.Parent = Bolt.Main
		Ang.Attachment0 = Bolt.Main.Attachment
		Lin.Attachment0 = Bolt.Main.Attachment
		Ang.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
		Ang.MaxTorque = math.huge
		Lin.MaxForce = math.huge
		Ang.Visible = true
		Ang.AngularVelocity = Vector3.new(0,0,30)
		
		local LookCFrame = Weight.CFrame
		local LookRot = Vector3.new(LookCFrame:ToOrientation())
		LookCFrame = CFrame.new(LookCFrame.Position) * CFrame.Angles(0, LookRot.Y, 0)
		
		Lin.VectorVelocity = LookCFrame.LookVector * 500
		
		Bolt:PivotTo(Weight.CFrame * CFrame.new(0,0,3))
		Bolt.Parent = workspace

Any reason as to why this occurs?

1 Like

Is this everything inside of the Script? Because I can find an issue

1 Like

that code is in a module script which is called from the script

this happens because network ownership oscillates between the server and the client, in order to fix that, simply set the ownership of all descendant base parts to server which disallows for clients to gain priority over the physics calculations for the given base part

2 Likes

where would i do this in the code, i tried and its not working

edit: set to player and it doesnt hang up on the client but on the server it does

1 Like

Could you try setting physics ownership to the server, so that the server starts simulating them immediately, otherwise it might be waiting for the client to become the owner and for the client to start simulating them.

2 Likes

i set it to the client, it stops hanging up on the clients end, but the server has it laggy still

1 Like

Either the client or the server will start simulating it immediately. The other will have the wait for the info to reach them. Atleast this is how I think it works currently.

1 Like