April06
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 5062 |
|
|
| 01 Jan 2013 06:51 PM |
Instead of doing this;
script.Parent.BottomSurface = "Smooth" script.Parent.TopSurface = "Smooth" script.Parent.LeftSurface = "Smooth" ect.
Is there an easier way? I know this is the way to do it if you want them to be separate but in this case I want all surfaces to be 1 type of surface.
script.Parent.Surface = "Smooth" does not work.
Do I need to define it before the script like;
A = ("BottomSurface", "TopSurface", "LeftSurface") script.Parent.A = "Smooth"
|
|
|
| Report Abuse |
|
|
|
| 01 Jan 2013 06:55 PM |
script.Parent.BottomSurface, script.Parent.TopSurface, script.Parent.LeftSurface = Smooth","Smooth","Smooth"
-~Obly of C&G~- |
|
|
| Report Abuse |
|
|
mamaguy
|
  |
| Joined: 07 Oct 2010 |
| Total Posts: 7073 |
|
|
| 01 Jan 2013 06:58 PM |
"Smooth","Smooth","Smooth" forgot the first " |
|
|
| Report Abuse |
|
|
April06
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 5062 |
|
|
| 01 Jan 2013 06:59 PM |
| Good idea, but it's still tedious to write. |
|
|
| Report Abuse |
|
|
April06
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 5062 |
|
|
| 01 Jan 2013 07:00 PM |
| I guess I'll try my definition idea and if it fails I'll try Ghost's. Thanks. |
|
|
| Report Abuse |
|
|
kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
|
| 01 Jan 2013 07:01 PM |
| you could just do it to all surfaces. |
|
|
| Report Abuse |
|
|
April06
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 5062 |
|
|
| 01 Jan 2013 07:11 PM |
script.Parent.BackSurface, script.Parent.BottomSurface, script.Parent.FrontSurface, script.Parent.LeftSurface, script.Parent.RightSurface, script.Parent.TopSurface = "Studs", "Studs","Studs", "Studs", "Studs", "Studs"
Is what I have. It's a mess. That's why I want it to be shorter. The definition part failed so I went with what Ghost said, it works, but now it looks like even a bigger mess. |
|
|
| Report Abuse |
|
|
mamaguy
|
  |
| Joined: 07 Oct 2010 |
| Total Posts: 7073 |
|
|
| 01 Jan 2013 07:45 PM |
type = "Studs" sides = {"Back", "Bottom", "Front", "Left", "Right", "Top"} for i=1, #sides do script.Parent[sides[i].."Surface] = type end
Not going to test it, OP, so you try it, sorry if it doesn't work :( Just an idea. |
|
|
| Report Abuse |
|
|
April06
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 5062 |
|
|
| 01 Jan 2013 07:48 PM |
| I'll try it tomorrow. Thanks. |
|
|
| Report Abuse |
|
|
Flash77
|
  |
| Joined: 14 Jun 2008 |
| Total Posts: 550 |
|
|
| 01 Jan 2013 07:50 PM |
type = "Studs" sides = {"Back", "Bottom", "Front", "Left", "Right", "Top"} for i=1, #sides do script.Parent[sides[i].."Surface"] = type end
forgot the " after Surface |
|
|
| Report Abuse |
|
|
mamaguy
|
  |
| Joined: 07 Oct 2010 |
| Total Posts: 7073 |
|
|
| 01 Jan 2013 07:50 PM |
@April Okay, np, I'll just try it now so tomorrow you can just look at this thread and see if it works or not |
|
|
| Report Abuse |
|
|
mamaguy
|
  |
| Joined: 07 Oct 2010 |
| Total Posts: 7073 |
|
| |
|
mamaguy
|
  |
| Joined: 07 Oct 2010 |
| Total Posts: 7073 |
|
| |
|
April06
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 5062 |
|
|
| 02 Jan 2013 11:19 AM |
| haha yes it does work. Thanks :) |
|
|
| Report Abuse |
|
|
April06
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 5062 |
|
|
| 02 Jan 2013 11:25 AM |
This is what my script looks like;
--April06 while true do A = script.Parent --Value definition A wait(0.1) A.Transparency = math.random() A.BrickColor = BrickColor.new(math.random(),math.random(),math.random()) A.Shape = ("Block") type = "Smooth" sides = {"Back", "Bottom", "Front", "Left", "Right", "Top"} for i=1, #sides do script.Parent[sides[i].."Surface"] = type end wait(0.1) A.Transparency = math.random() A.BrickColor = BrickColor.new(math.random(),math.random(),math.random()) A.Shape = ("Ball") type = "Weld" sides = {"Back", "Bottom", "Front", "Left", "Right", "Top"} for i=1, #sides do script.Parent[sides[i].."Surface"] = type end wait(0.1) A.Transparency = math.random() A.BrickColor = BrickColor.new(math.random(),math.random(),math.random()) A.Shape = ("Block") type = "Universal" sides = {"Back", "Bottom", "Front", "Left", "Right", "Top"} for i=1, #sides do script.Parent[sides[i].."Surface"] = type end wait(0.1) A.Transparency = math.random() A.BrickColor = BrickColor.new(math.random(),math.random(),math.random()) A.Shape = ("Ball") type = "Studs" sides = {"Back", "Bottom", "Front", "Left", "Right", "Top"} for i=1, #sides do script.Parent[sides[i].."Surface"] = type end end |
|
|
| Report Abuse |
|
|
April06
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 5062 |
|
|
| 02 Jan 2013 11:29 AM |
I have realized that the extra same lines really don't do that much difference so I cut them down to this;
--April06 while true do A = script.Parent --Value definition A wait(0.1) A.Transparency = math.random() A.Reflectance = math.random() A.BrickColor = BrickColor.new(math.random(),math.random(),math.random()) A.Shape = ("Block") type = "Smooth" sides = {"Back", "Bottom", "Front", "Left", "Right", "Top"} for i=1, #sides do script.Parent[sides[i].."Surface"] = type end wait(0.1) A.Shape = ("Ball") type = "Weld" sides = {"Back", "Bottom", "Front", "Left", "Right", "Top"} for i=1, #sides do script.Parent[sides[i].."Surface"] = type end wait(0.1) A.Shape = ("Block") type = "Universal" sides = {"Back", "Bottom", "Front", "Left", "Right", "Top"} for i=1, #sides do script.Parent[sides[i].."Surface"] = type end wait(0.1) A.Shape = ("Ball") type = "Studs" sides = {"Back", "Bottom", "Front", "Left", "Right", "Top"} for i=1, #sides do script.Parent[sides[i].."Surface"] = type end end |
|
|
| Report Abuse |
|
|
mamaguy
|
  |
| Joined: 07 Oct 2010 |
| Total Posts: 7073 |
|
|
| 02 Jan 2013 12:32 PM |
--April06 sides = {"Back", "Bottom", "Front", "Left", "Right", "Top"} while true do A = script.Parent --Value definition A wait(0.1) A.Transparency = (math.random(10)/10) A.Reflectance = (math.random(10)/10) A.BrickColor = BrickColor.new(color3.new(math.random(255),math.random(255),math.random(255)) A.Shape = ("Block") type = "Smooth" for i=1, #sides do script.Parent[sides[i].."Surface"] = type end wait(0.1) A.Shape = ("Ball") type = "Weld" for i=1, #sides do script.Parent[sides[i].."Surface"] = type end wait(0.1) A.Shape = ("Block") type = "Universal" for i=1, #sides do script.Parent[sides[i].."Surface"] = type end wait(0.1) A.Shape = ("Ball") type = "Studs" for i=1, #sides do script.Parent[sides[i].."Surface"] = type end end
This should work better, The sides is a table, so it will always be there for you to access it, so you don't need to repeatedly put it down. To read about tables:
http://wiki.roblox.com/index.php/Table
I changed it from "BrickColor.new(math.random(), math.random(), math.random())" to what is there now, because BrickColor.new takes an ID number, or a name, while color3 makes the color completely random, and I changed it from () to (255) because Color3 has the RGB, (Red, blue, green), each taking a number from 1 to 255, and if you do not put two numbers in math.random, it will assume the starting number is 1. For math.random, and the brickcolor/color3, go here:
http://wiki.roblox.com/index.php/BrickColor
http://wiki.roblox.com/index.php/Math.random
And the reflectance/transparency includes changes because a math.random() left blank is either 0 or 1, it doesn't go in between, reflectance and transparency's min/max are 0 and 1, so I took it and made it from 1 to 10, then divided it by 10, so if it was 6, it would be 0.6. And you can read the math.random up there ;) Hope this helps |
|
|
| Report Abuse |
|
|
April06
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 5062 |
|
|
| 02 Jan 2013 01:33 PM |
Thank you every much :))
I wrote down the side changes 4 times because I want it to be random every time between those 4.
I learned something new again. |
|
|
| Report Abuse |
|
|
April06
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 5062 |
|
|
| 02 Jan 2013 01:35 PM |
@above
I mean these
type = "Studs" for i=1, #sides do script.Parent[sides[i].."Surface"] = type end
still trying to find on my own how to make it random every time without doing it 4 times in the script. |
|
|
| Report Abuse |
|
|
April06
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 5062 |
|
|
| 02 Jan 2013 01:40 PM |
BrickColor.new(color3.new(math.random(255),math.random(255),math.random(255))
I think you forgot another ) at the end here. |
|
|
| Report Abuse |
|
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 02 Jan 2013 01:43 PM |
Making it into a function would make it as one line:
function Surface(part,kind,tableWhatSurfaces) Surfaces = {"Top","Bottom","Front","Back","Left","Right"} if not tableWhatSurfaces then for num,obj in pairs(Surfaces) do part[obj.."Surface"] = kind end else for num,obj in pairs(tableWhatSurfaces) do part[obj.."Surface"] = kind end
So to make all surfaces smooth, you would do like:
Surface(game.Workspace.Part,"Smooth")
And to make top one with studs, you would do like:
Surface(game.Workspace.Part,"Studs",{"Top"}) |
|
|
| Report Abuse |
|
|
April06
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 5062 |
|
|
| 02 Jan 2013 01:47 PM |
Hmm. "color3.new" is supposed to be "Color3.new" otherwise it doesn't work.
A.BrickColor = BrickColor.new(color3.new(math.random(225),math.random(225),math.random(225)))
Also it only switches between white and gray now... |
|
|
| Report Abuse |
|
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 02 Jan 2013 01:48 PM |
Because in roblox Color3 takes variables from 0-1, not 0-255.
You could try doing like:
math.random(255/255) |
|
|
| Report Abuse |
|
|
April06
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 5062 |
|
|
| 02 Jan 2013 01:58 PM |
Still white and gray.
I have changed it to
A.Color = Color3.new(math.random(),math.random(),math.random())
Now it works... if I insert any number in there it only goes to white, then grey. Even if it's like 225/255 |
|
|
| Report Abuse |
|
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 02 Jan 2013 02:08 PM |
| then you should do like math.random(0,255/255) |
|
|
| Report Abuse |
|
|