Allow certain properties changed by client to replicate to the server

I am currently working on a game where the client has to tell the server to change the transparency of multiple parts. The problem is, when in bigger servers, the server will lag and the effect will break. Is there a way to allow the client to change certain properties?

EDIT: I am using remote events however this is too laggy.

Maybe Instead of Firing the Server multiple times, give the information only in one time? or keep a yield or cool down for some time, to not exhaust the resources?

The client fires the function with no params. The server locates the model and changes the transparency of the parts in the model

It depends. maybe if you give a practical example, we can help you figure out a good way to do it!

I have a rig that turns invisible. When the player presses a key, the rig fades from visible to invisible and vice versa. However this creates a lot of lag on the server when using it in 100 player servers. Is there a way around this?

what about having a function in the server that turns on or off the transparency for all the parts by one event call?

Rather than turning an event for every part

It is an event that turns off all the transparency for all of the parts.

You would use the same remote event. First, you would fire it to the server, then, the server does nothing but fire it back to all the clients:

Sending(in local script)

local Remote = -- the remote
Remote:FireServer()

Receiving(in server script):

local Remote = -- the remote

Remote.OnServerEvent:Connect(function()
    Remote:FireAllClients()
end)

Reveving(in same local script):

Remote.OnClientEvent:Connect(function()
    -- fade script
end)

This will ensure that the server won’t have to handle too much and cause lag to all clients.

3 Likes

But isn’t that doing the same thing. the parts will still fade in client. or am i missing the point?

If you do it on the server, people with a high ping will see it fade really weirdly, but doing it on the client doesn’t rely on ping, so the server won’t have to replicate it to the client(trust me, it’s much better).

1 Like

but doing it on the client. it means the other players won’t see the transparency change?!

The point is that the remote uses FireAllClients(), which tells the all clients to set the transparency. But if you worry that new people wont see that the part is transparent, simply make the part transparent on the server after a few seconds.

1 Like

It reduces the strain on the server to update the transparencies of the part then make the clients replicate the change, rather than just updating it directly on the client

1 Like

Oh ok now i understand! 30 characters