of     1   

TheCoderOfLua
#193776521Saturday, July 16, 2016 7:16 AM GMT

Yes how would this be done because right now it lags the server the crap. Thanks :P Current method: while wait() do for i,a in pairs(bleh:GetChildren()) do a.CFrame = pos end end
cfiredog
#193776576Saturday, July 16, 2016 7:17 AM GMT

I would suggest trying to use :MoveTo in order to move the bricks. http://wiki.roblox.com/index.php?title=API:Class/Model/MoveTo
TheCoderOfLua
#193776952Saturday, July 16, 2016 7:27 AM GMT

oh hey, The bricks move seperately using a complicated iterating system, so moving the whole model wouldnt help.
cfiredog
#193776985Saturday, July 16, 2016 7:28 AM GMT

Oh, so you are trying to move each part separately at different time periods?
TheCoderOfLua
#193777024Saturday, July 16, 2016 7:29 AM GMT

Exactly.
pidgey
#193777085Saturday, July 16, 2016 7:30 AM GMT

WHY ARE YOU MAKING A LOOP TO KEEP PUTTING A BUNCH OF OBJECTS IN THE SAME PLACE pidgey is my name sh##posting is my game
TheCoderOfLua
#193777132Saturday, July 16, 2016 7:31 AM GMT

Well my code is complex but it is differnet.
pidgey
#193777151Saturday, July 16, 2016 7:32 AM GMT

tell me why you're doing it and i might be able to help????? pidgey is my name sh##posting is my game
cfiredog
#193777234Saturday, July 16, 2016 7:33 AM GMT

Then I would use this method: for _,v in pairs(game.Selection:Get()) do v.CFrame = v.CFrame * CFrame.new(0, 0, 0) end via ROBLOX Wiki: http://wiki.roblox.com/index.php?title=CFrame
TheCoderOfLua
#193777308Saturday, July 16, 2016 7:35 AM GMT

well. There is a main part, which goes in the lookVector of itself, which can be changed with the arrow keys. Now, theres 100 parts behind following it, with a delay as it goes further down. So how would I make this not as laggy :P
pidgey
#193777453Saturday, July 16, 2016 7:38 AM GMT

one at a time, not all at a time like the script you posted make a wait time in the pairs function and in the wait function but if you're trying to move tons of parts at once like that it will lag a lot more no matter what pidgey is my name sh##posting is my game
pidgey
#193777479Saturday, July 16, 2016 7:39 AM GMT

yeah i cant help but ill take that +1 post pidgey is my name sh##posting is my game
dearjournal
#193777699Saturday, July 16, 2016 7:44 AM GMT

use RunService functions. i would never use wait() for what it sounds like you're doing. describe what your goal is, in a little more detail, and we will try to come up with an efficient solution.
dearjournal
#193777845Saturday, July 16, 2016 7:47 AM GMT

"make a wait time in the pairs function and in the wait function" i don't know about roblox lua, but in the "normal" implementation of lua, you wouldn't want to use wait() like that. calling wait() for every object adds a lot of overhead in the backend i think because of C lua_yield and lua_resume functions being called. doing that would increase lag i am guessing. just go over all of them at once.
TheCoderOfLua
#193777860Saturday, July 16, 2016 7:48 AM GMT

Thanks dearjournal. Right now, (sry I forgot) Im using game:GetService("RunService").Heartbeat:wait() Anyways, I'm making a 3d slither.io game. I used to have local movement and it worked fine, but when other plays moved around it only worked like 5fps for them. So i decided to make it server side. That means the server code is loading with remote events telling it what to do, maybe 5 models, with 20 parts inside each. I cant use bodyforces since the little balls that make it up are anchored (for a reason) Anyways should I make it generate a script for each model so one script isnt overloaded? Tell me if i need to explain
TheCoderOfLua
#193778223Saturday, July 16, 2016 7:59 AM GMT

aaaaaaaaaaaaaa
dearjournal
#193778254Saturday, July 16, 2016 7:59 AM GMT

you shouldn't have to worry about a script being overloaded. it'd be more for design principles and readability, but each script body is essentially just an alias for a coroutine function anyways. doesn't matter if all your game is running from one server script and one local script, or 1,000. i would definitely go back and try to re-implement it with FE. send only vital info to the server like what direction the player is choosing to go in. some vital questions to ask: -if you're using RemoteFunctions, are you sending entire Instances as arguments, or just vital information like a Vector3 telling where to move to next, etc. I'm not too sure what your scripts setup is so I can't give you specific advice, sorry. " server code is loading with remote events telling it what to do, maybe 5 models, with 20 parts inside each." are you passing these Model Instances and Part Instances as arguments in a looped wait() function? this might be the cause of the lag and I would suggest doing a redesign based on sending only user input to the server. there will be a delay but you can compensate by moving the players snake on the client with a localscript while you wait for the server to send back feedback on the users movement input.

    of     1