Any solutions for speeding up the replication and removal of an Instance when testing for lag?

Obviously there will be a delay to some of your coding when you enable IncomingReplicationLag. The issue is my skating system relies heavily on BodyVelocity response time. It needs to be quick to appear and disappear when commanded to. If it’s late or delayed it creates this awkward hitch effect. Without lag, this is not a issue whatsoever. With simulated lag, the problem is apparent.

Here is what it looks like with IncomingReplicationLag of 0.4…

Here is what it looks like without any IncomingReplicationLag

I could make this all client side and call it a night, but there is some serious security issues tied to that. Lot’s of my local scripts get exposed and exploiters manipulate the code to give themselves an advantage. With the skating mechanic being such a crucial part of the game I would hate for exploiters to not only steal my work, but use it as an advantage for themselves on their client.

I tried setting it to a Heartbeat function instead of it’s current function which runs off of MoveDirection. I also tried Stepped. Neither was able to improve the speed.

I also tried detecting the players movements with their HumanoidRootPart’s Velocity rather than the MoveDirection. Also I tried detecting the HumanoidRootPart’s Velocity Magnitude. I even tried to detect the MoveDirection’s Magnitude rather than the MoveDirection itself. That showed no improvements either.

I searched through the DevForum and the Developer Hub and other sites. I even asked for help from fellow friends. Nothing has been figured out yet in regards to keeping this a server script.

Here is the the server script I currently use to test on this issue…

local character = script.Parent
local hrp = character.HumanoidRootPart
local humanoid = character.Humanoid

	if humanoid.MoveDirection ~=,0,0) then
		local velo = hrp:FindFirstChild("BodyVelocity")
		if velo then

	elseif humanoid.MoveDirection ==,0,0) and hrp:FindFirstChild("BodyVelocity") == nil then
		local bv ="BodyVelocity", hrp)

If anyone has any solutions for this it would be greatly appreciated. For now I will continue to test on this script to see if I can discover anything else. I hope you all have a good day!

1 Like

player-movement should be handled on the client not the server

I am aware that all player movements should be done on the client side. I usually do that, but recently my movement scripts are being exposed by exploiters and they steal them and/or use them for an advantage in the game. There must be some sort of way to do this on the server side. I mean it works fantastic until you add the replication Lag.

If you want this to be as smooth as possible you would need to keep this on the client and have the server validate that the client is moving correctly.

So there is no possible way I could make this smoother and run quicker server side? Cause I really dislike the idea of moving to the client where one of the core features of the gameplay is exposed, and can be abused by exploiters.

There will always be a delay since you are communicating between a server and a client.

Alright, so say I did move it back to the client. What are some methods I could use to counter exploiters?

use something that checks where all players are at an interval:

local OldPositions = {} -- dictionary of player positions, have a playerremoving connection remove the players from it so it can be gced
local DistanceInASecond = 15 -- distance in studs the player can move in a second on an unmodified client
while true do
    for _,Player in pairs(game.Players:GetPlayers()) do
        if not OldPositions[Player] then
            OldPositions[Player] = Player.Character.HumanoidRootPart.Position
        if (Player.Character.HumanoidRootPart.Position - OldPositions[Player]).Magnitude > DistanceInASecond then -- check that they didn't go over x studs in a second, if they did, they might be exploiting
            Player.Character.HumanoidRootPart.Position = OldPositions[Player] -- reset them back, might just be lag, don't 100% know if it's exploits
            OldPositions[Player] = Player.Character.HumanoidRootPart.Position -- the check is fine, update the position for a new check

Note that your code can, and likely will be stolen by exploiters, but that’s a risk you need to take to provide players with a good experience. If you don’t want to take that risk, you won’t be able to create good games on roblox :man_shrugging:

1 Like

I gave it another day to try some other things involving RemoteFunctions and RemoteEvents. You are right though. Player movements is not something that should be done through the server. It’s needs a lightning quick response. The only way to accomplish that is through the client. There is no getting around it, no matter how hard you try. You can get it to work server side, but you would be ignoring players in your game that have lower end devices and/or live far away from U.S.A servers. That’s a very exclusive way to build a game. The game should be open to as many people as people. Even if my game has a ton of exploiter activity, I shouldn’t shy away from putting important character response information inside a client script. Instead the focus should be on adding server checks to make sure there isn’t a player abusing things inside the client. I can’t stay paranoid of these exploiters forever, I need to at least have some local scripts open for performance sake. Thank you to the three of you for the wake up call. I appreciate the help!