Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

FilteringEnabled: How do I get past the server changing values for a particular client?

Asked by 8 years ago

Introduction

So, I'm experimenting with FilteringEnabled, and I need some things to replicate to the other players for my vehicles to work properly (Sounds, Motors, stuff like that). I have a local script under the vehicle that detects changes (using the .Changed event) and sends the values to the server via RemoteEvent, which sets the values so everyone can see them.

The Problem

Since the server is also setting values that the driver is setting, there's a little jitter between when the client sets values and when the server sets them. This is most noticeable when setting a value quickly and incrementally.

Example

From the client to the server

--"Val" is a value being monitored for changes
--"Server" is a folder containing the RemoteEvent
Val.Changed:connect(function(p)
local newValue=Val[p]
Server.RemoteEvent:FireServer(Val,p,newValue)
end)

...And the server can now replicate the value(s)

--"Server" is a folder containing the RemoteEvent
Server.RemoteEvent.OnFireServer:connect(function(Player,Object,ValueName,Value)
Object[ValueName]=Value
end)

One way to avoid this is to have the Server use :FireClient() on all the client except the one controlling the vehicle, but this requires the values to go from one client to the server and then to all the clients. This also means that a new player joining the server won't see the value replications that took place earlier before. I'm trying to avoid doing this, even though it works. I feel like there's is a better way.

Thanks in advance.

1 answer

Log in to vote
0
Answered by 8 years ago

And here lies the week link of developing games or server/client relation ship, latency. There is not a good way to avoid it because it takes X amount of time for information to travel to the client and then X amount of time for the client to respond to the server. You also face a problem when some clients react slower than others because of connectivity issues or the speed of the client itself. There sin't a good way to get around this problem because there is nothing much we can do about latency issues.

0
Awh... Thanks anyways. I guess this means most vehicles won't be able to work as great with filtering on. Its a shame :( If only there was a way that developers can allow certain object to bypass the filter. JayManLive 15 — 8y
0
Well, even if that would be so you still would have latency problems with the server and client. The way to attempt to avoid this is to slow down the change. BobserLuck 367 — 8y
Ad

Answer this question