It shouldn’t, if this is running each time the game renders a player stepping (walking), the only occasion I could see this affecting latency hugely (and negatively) is if it runs too quickly too much (like a while true do statement with no wait in it, personally I add a wait to basically everything (where the waits should be) to correct issues like that. I suggest adding a wait() at the beginning when the function runs. No number in the wait means it will only wait the smallest amount of time possible (anywhere on a client from 1/10th of a second to 1/10000th of a second)
That’s not going to change anything. RenderStepped will fire every frame, regardless of whether you stuck a wait() at the end of the last frame or not.
I see the fault in there, so wouldn’t the wait() at the beginning of the function be more helpful, waiting the smallest amount of time possible before firing the remoteEvent on every step, also thanks for the feedback on my reply!
That wouldn’t help either, it would just wait the first time it fires and then it would always fire after the same amount of time. You don’t need a wait at all, a RenderStepped connection will always just fire once every frame.
What you should do is something every here and there. 15 times per second is more than enough and is actually the tick rate roblox uses to replicate movement by default.
Something like this should work better
Send the signal from the client to the server at a slower rate. Then you have two options.
Perform translations on the server using Heartbeat (Which could still cause network lag)
Tell every other client about the change, and have them perform local translations.
With some good networking skills, you can make #2 incredibly efficient. Something like this on the server
local network = {}
network.RemoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent")
function network:FireClient(client,data)
network.RemoteEvent:FireClient(client,data)
end
function network:FireAllClientsWithException(clientToIgnore,data)
for iteration, player in ipairs(game.Players:GetPlayers()) do
if player ~= clientToIgnore then
network:FireClient(player, data)
end
end
end
This actually does change quite a bit. RenderStepped is known to fire functions before a frame renders. Putting a wait or an expensive function there can delay when a frame renders and block other code.