Replicating to server

Hello!
I was wondering what method you recommend me to Replicated arms movement,

This are weapons, I use C0 of the Right Shoulder and Left Shoulder

But when I try to replicate, (firing a remote event and changing Torso > Left Shoulder and torso > right shoulder) C0, something weird happens, and it starts to glitch for the client.

What method do you recommend me for replication to server?

:smiley:

My favourite method is this:

2 Likes

You would simply just replicate a table consisting of the C0 itself and the motor object.

1 Like

But, Firing a Remote Event every single 0.1 secs wouldn’t cause a bit of lag?

No, you do it ever 0.1 seconds which wouldn’t. I don’t know how to explain why it doesn’t lag, but I’ve done this many times before and it doesn’t.

1 Like

Your ping would be affected by how much data (as in size) you send in a rapid succession, not how often.

1 Like

So, should I fire on EVERY client the tilt event?

Every client except your own. The reason why the tweening method is buggy is because your also moving your joint at the same time.

Ok so, what do you think about this?

game.ReplicatedStorage.WeaponSystem.Events.ReplicateArms.OnServerEvent:Connect(function(Player,RightShoulder, NewRightC0, LeftShoulder, NewLeftC0)
	for i,v in ipairs(game.Players:GetPlayers()) do
		if Player:DistanceFromCharacter(v.Character.Head.Position) <= 100 and v ~= Player then
			game.ReplicatedStorage.WeaponSystem.Events.ReplicateArms:FireClient(v, RightShoulder,NewRightC0, LeftShoulder, NewLeftC0)
		end
	end
end)

That should be fine. I’d recommend using my code and modifying it slightly.

Alrighty, Last question, what would be Memory leaks? and how to prevent,
If you know any post that could help me

By disconnecting from connections that are created frequently. You don’t need to disconnect from PlayerAdded, but you may need to disconnect from CharacterAdded or Died.

1 Like