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

How can I make this script more simplified, if possible?

Asked by 9 years ago

I've created a part with BodyPosition. It moves around in a circle because of the positions I've set it. There are 12 blocks that form the circle, and I had made it so it moves to each block. It feels pretty lengthy to me, however. Is there a more simplified or even an easier way to achieve the same results?

01local box = game.Workspace.Box
02local bodypos= box.BodyPosition
03local pos1 = box.b1
04local pos2 = box.b2
05local pos3 = box.b3
06local pos4 = box.b4
07local pos5 = box.b5
08local pos6 = box.b6
09local pos7 = box.b7
10local pos8 = box.b8
11local pos9 = box.b9
12local pos10 = box.b10
13local pos11 = box.b11
14local pos12= box.b12
15 
View all 44 lines...

1 answer

Log in to vote
0
Answered by 9 years ago

See if this works:

01local box = game.Workspace.Box
02local bodypos= box.BodyPosition
03 
04local poses = {
05    box.b1, box.b2, box.b3, box.b4, box.b5, box.b6,
06    box.b7, box.b8, box.b9, box.b10, box.b11, box.b12
07}
08 
09while true do
10     for i=1, #poses do
11        bodypos.position = poses[i].Position
12        wait(0.9)
13    end
14end
0
Sort of. However BodyPosition values do not seem to take any effect :( XxMitch90210xX 10 — 9y
1
Oh wait! It's because wait(0.9) is not wait(0.09) Thank you! XxMitch90210xX 10 — 9y
0
Not clear yet. Whenever I try to duplicate the model, the copied one does not work :( XxMitch90210xX 10 — 9y
1
I'm sorry again! I found the answer. The first line should be local box = script.Parent....Thanks again! XxMitch90210xX 10 — 9y
0
x3 you having troubles today man? haha NAWESOME14 40 — 9y
Ad

Answer this question