RoboGean
|
  |
| Joined: 24 Mar 2011 |
| Total Posts: 577 |
|
|
| 02 Jan 2015 09:42 PM |
Would this work? If not, what WOULD work?
local sp = script.Parent
local size = sp.Size
function change() size = (math.Random(1-5)),(math.Random(1-5)),5 --Keeping the Z value the same end
while true do wait() loop()
end
I'm just wanting to know if this would work |
|
|
| Report Abuse |
|
|
RoboGean
|
  |
| Joined: 24 Mar 2011 |
| Total Posts: 577 |
|
|
| 02 Jan 2015 09:44 PM |
| Whoops, on the last bit, pretend the "loop()" part isn't there |
|
|
| Report Abuse |
|
|
|
| 02 Jan 2015 09:52 PM |
Working script:
function change() local sp = script.Parent local randomvalue = math.random(1,5) sp.Size = Vector3.new(randomvalue,randomvalue,5) --Keeping the Z value the same end
while true do --Loops the change() function change() --Fires the function to change the brick's shape wait() --How often you want the bring to change its shape end
Note: math.random() is always typed in lower case, and to say "from 1 to 5" you don't put (1-5). Instead, replace the dash with a comma.
|
|
|
| Report Abuse |
|
|
RoboGean
|
  |
| Joined: 24 Mar 2011 |
| Total Posts: 577 |
|
|
| 02 Jan 2015 09:55 PM |
| Thanks dude, do I need to keep the sp inside the function? |
|
|
| Report Abuse |
|
|
|
| 02 Jan 2015 10:04 PM |
| Nope, it'll work outside the function too. |
|
|
| Report Abuse |
|
|
RoboGean
|
  |
| Joined: 24 Mar 2011 |
| Total Posts: 577 |
|
|
| 02 Jan 2015 10:08 PM |
| And that way I can use sp in other functions correct? |
|
|
| Report Abuse |
|
|
| |
|