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

What is the best way to move an object server-side?

Asked by
Smunkey 95
8 years ago

If I want to cause a brick to move forward server-side how should i go about it?

I know there is cframe, body velocity, and velocity. Maybe more.

CFrame seems like the laggiest option as it would cause constant updates and would generally eat up tons of bandwidth, especially if there where quite a few of them going off at once.

body velocity seems like the best option because (i think) it's like velocity except it's constant, no slowing down or changing trajectory due to gravity.

And velocity which seems like the easiest way to go about it, and i could just add a 'fly()' function to keep it from falling.

Or should I just have it done locally for every player in the game? This options seems like hardest/worst option but would cause the least lag (i think). I would like to avoid this option if absolutely 102% necessary.

There are going to be possibly hundreds of these objects existing at one time, but i need them to move the same way for everyone and be able to interact the same way with everyone. So what's my best option to go about this?

1
CFrame is plenty alright, as long as it is implemented half decently you should have no problem (modern computers can handle hundreds of thousands of computations at runtime, depending on complexity). If you want ease of use though, go for body velocity. BlackJPI 2658 — 8y

2 answers

Log in to vote
0
Answered by 8 years ago

If you want a part to be influenced by physics then use bodymovers, it doesnt matter if it is very intensive because usually roblox handles physics updates with their servers and you want to move the part server-side anyway.

If you want to use CFrame and want a solution that doesnt end up making the server laggy then use the lerp() method. This smooths out movement of a part and isnt influenced by physics. This method has three arguments (startPosition, endPosition, time). Time is basically how long it takes to get from one position to another.

I highly reccomend that you do not move the parts on the client side as that will make everything so much laggier. There is a reason roblox provides powerful server power for us developers and that is for us to use it and its physics engine.

Ad
Log in to vote
1
Answered by 8 years ago

Hard question, but if there's not that many parts moving i would go with "Body velocity".

Also what are you going to do with the parts that you are trying to move? I find it hard to believe that you need about 100 parts moving at the same time.

0
cartoonish rapid fire weapon with big chunky colorful bullets. Smunkey 95 — 8y
0
Gg! I would of just used particles for that, but keep it up i guess! xD Cyprus_Alexander 10 — 8y

Answer this question