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

Can BodyForce, BodyPosition, BodyGyro,... work with local script?

Asked by 5 years ago
Edited 5 years ago

My game is mostly physics based. And it must use those body objects. But since using remote events to let the server runs it continuously will cause lag even with a 1 player server. How to prevent the lag? Is there any other ways of doing this?

1 answer

Log in to vote
1
Answered by
mattscy 3725 Moderation Voter Community Moderator
5 years ago

If you want to control the BodyMovers from LocalScripts, you are able to give them network ownership from the server. Once you have set a part's network owner to a client, any influence that client has on the part will automatically replicate to the server, thus allowing for immediate feedback for the client and syncing to the other clients (this is how characters work). This means that any BodyMovers you make with LocalScripts on parts that have the client as a network owner will show for everyone.

However, if you set the network ownership of a part, the client that 'owns' the part has control over it. This means that exploiters can insert BodyMovers and move the part wherever they want with their exploits. Beacuse of this, if you decide to use network ownership, you should add server-sided checks to tell if the part is moving how it should & acting correctly.

Hope this helps!

0
Thanks. Also, can you stop setting the network ownership to the player? Konethorix 197 — 5y
0
Yep, just use SetNetworkOwner with nil as the argument. mattscy 3725 — 5y
Ad

Answer this question