radzan
|
  |
| Joined: 13 Jun 2010 |
| Total Posts: 692 |
|
|
| 22 Dec 2012 11:33 AM |
This is a script that continualy changes the celocity of a brick. N = script.Parent Z = Velocity.Z N[Z]= N[Z]+20 wait(50) N[Z] = N[Z]-20 wait(20) N[Z] = N[Z]-20 wait(50) N[Z] = N[Z]+20
|
|
|
| Report Abuse |
|
|
|
| 22 Dec 2012 11:39 AM |
N = script.Parent Z = N.Velocity.Z Z = Z + 20 wait(50) Z = Z - 20 wait(20) Z = Z - 20 wait(50) Z = Z + 20
~ вℓα¢квσу167тнѕт, тєн вєѕт єνα. ∂υηт мєѕѕ ωιт тєн ρяσ. ~ |
|
|
| Report Abuse |
|
|
|
| 22 Dec 2012 11:50 AM |
@blackboy
That would not function the way you want it to, because it would change the value of the variable, not the velocity. This is why you can't set variables to specific properties.
Z = Z+20 will set the variable called "z" to 20, not the Z-axis velocity of the part. |
|
|
| Report Abuse |
|
|
radzan
|
  |
| Joined: 13 Jun 2010 |
| Total Posts: 692 |
|
| |
|
Kondou
|
  |
| Joined: 05 Aug 2012 |
| Total Posts: 1148 |
|
|
| 22 Dec 2012 02:17 PM |
While true do n = script.Parent n.Velocity = math.random(-20,20) wait(20)
I think that would work too. |
|
|
| Report Abuse |
|
|
radzan
|
  |
| Joined: 13 Jun 2010 |
| Total Posts: 692 |
|
|
| 22 Dec 2012 02:20 PM |
| Wouldn't that be random instead of organised? |
|
|
| Report Abuse |
|
|
Kondou
|
  |
| Joined: 05 Aug 2012 |
| Total Posts: 1148 |
|
|
| 22 Dec 2012 02:23 PM |
| Yeah it would go anywhere from -20 to 20, did I misunderstand how you wanted to do that? Sorry let me see if I can come up with something that will only do -20 and 20. |
|
|
| Report Abuse |
|
|
Kondou
|
  |
| Joined: 05 Aug 2012 |
| Total Posts: 1148 |
|
|
| 22 Dec 2012 02:25 PM |
While true do n = script.Parent n.Velocity = -20 wait(20) n.Velocity = 20 wait(20)
There, now it should do -20, wait 20 seconds, do 20, wait 20 seconds, then loop back up to the top? If it doesn't work, I'd love if someone explained why. I'm only learning scripting slowly. |
|
|
| Report Abuse |
|
|
Kondou
|
  |
| Joined: 05 Aug 2012 |
| Total Posts: 1148 |
|
|
| 22 Dec 2012 02:28 PM |
Oh, don't capitalize while.
Also, I just noticed the script won't work. Which way do you want it to move the brick? The velocity has X,Y,and Z |
|
|
| Report Abuse |
|
|
Kondou
|
  |
| Joined: 05 Aug 2012 |
| Total Posts: 1148 |
|
|
| 22 Dec 2012 02:30 PM |
Ignore my silly rambling above. Here is what I got now, works too.
while true do n = script.Parent n.Velocity = Vector3.new(-20,0,0) wait(20) n.Velocity = Vector3.new(20,0,0) wait(20) end |
|
|
| Report Abuse |
|
|
shayan414
|
  |
| Joined: 11 Aug 2008 |
| Total Posts: 8090 |
|
|
| 22 Dec 2012 03:04 PM |
| @kondou I believe he wants the values to go in a specific order instead of randomly. |
|
|
| Report Abuse |
|
|
Kondou
|
  |
| Joined: 05 Aug 2012 |
| Total Posts: 1148 |
|
|
| 22 Dec 2012 03:06 PM |
| Then my newest script should do the job, right? |
|
|
| Report Abuse |
|
|
shayan414
|
  |
| Joined: 11 Aug 2008 |
| Total Posts: 8090 |
|
|
| 22 Dec 2012 03:09 PM |
| Yeah I believe thats what he wants. Unless he is looking to break the loop at a specific point. If he wants the pattern to go on until a specific point the for loop would be useful but until he replies again I think you got what he wanted. |
|
|
| Report Abuse |
|
|
Kondou
|
  |
| Joined: 05 Aug 2012 |
| Total Posts: 1148 |
|
| |
|