|
| 30 Aug 2016 08:42 AM |
( Beginner scripter here )
I am trying to learn For and While Wait Do, and this script doesn't seem to function
local Part = Instance.new('Part', game.Workspace)
Part.Anchored = true
while wait() do for y=0, 100, 1 do Part.Position = (0,y,0) wait(0.1) end for y=0, 100, -1 do Part.Position = (0,y,0) wait(0.1) end end
|
|
|
| Report Abuse |
|
|
UFAIL2
|
  |
| Joined: 14 Aug 2010 |
| Total Posts: 6905 |
|
|
| 30 Aug 2016 08:47 AM |
It's not while wait() do, it's while (condition == true) do.
Issues: You are not creating a Vector3, but instead are just supping the XYZ as a tuple. It should be Vector3.new(0,y,0). Your second for loop would be running inf. because you start from 0, are going towards 100, and are counting down. If you flip the 0 and 100 around it should work. |
|
|
| Report Abuse |
|
|
|
| 30 Aug 2016 08:49 AM |
^ that did not fix anything.
|
|
|
| Report Abuse |
|
|
UFAIL2
|
  |
| Joined: 14 Aug 2010 |
| Total Posts: 6905 |
|
|
| 30 Aug 2016 08:51 AM |
Except it does. This worked fine.
local Part = Instance.new('Part', game.Workspace)
Part.Anchored = true
while wait() do for y=0, 100, 1 do Part.Position = Vector3.new(0,y,0) wait(0.1) end for y=100, 0, -1 do Part.Position = Vector3.new(0,y,0) wait(0.1) end end
|
|
|
| Report Abuse |
|
|