RemoteEvent validation laggy, the event should be spammed

Hi!
I’m editing AC6_FE_Sounds, basically it calls a RemoteEvent to UpdateSound whenever the car goes faster. But it doesn’t validate the request, exploiters are using it to change normal game sounds or to play profane content.

I’ve added a simple check:

if not table.find(FE_Sound_Patch, sound.SoundId) then
  warn(sound.SoundId)
  return false
end

But now it’s really laggy - so it’s unplayable.
I know the fix is in the way the sound dynamic should work but I cannot edit the whole system.
Anything I can do?

One of the reasons I find this suspicious is because the default SS handler has this:

local sn = Sounds[sound]
if id~=sn.SoundId then sn.SoundId = id end
if pit~=sn.Pitch then sn.Pitch = pit end
if vol~=sn.Volume then sn.Volume = vol end

So surely it must be able to handle an extra index and if without causing noticeable lag.
Thanks!

I’m confused – at near heartbeat rates the client is sending an event with a SoundID, pitch and volume? Should not the server be the one handling it based on the movement of the car? I get your necessity for validating the request since they’re able to launch whatever values they want, but this may be grounds for an entirely new architecture rather than fixing the hole in the current one.

Hello. I’m just as confused lol.
This is an old version of A-Chassis Tune for a client and I do not have the time or the job to rescript it in the way that I would have to (since it’s not an easy rescript).
So this patch is the best I can do at the moment.

Ok, does the SoundID ever need to change? It looks like your parameters on the server are id, pit, vol and the sound in question is sn
How big is the table FE_Sound_Patch? If it’s your primary cause for lag I’d imagine it’s quite large.

Since you have a table of sounds already, perhaps you should have the client fire an index to a dictionary, not their own SoundID. ie:

local FE_Sound_Patch = {
    ["1"] = "rbxassetid://...."
}

then the client fires id=1 to the server. Server responds by setting sn.SoundId = FE_Sound_Patch[id]

This would mean the client has no direct reference to an audio file. You can assert the index exists anyways with:
if not table.find(FE_Sound_Patch, id) then return end

Ideally for the other two values you’d have them send a singular variable, something to do with speed of the vehicle, and the server derives pit and vol from there.

1 Like