Legalizes
|
  |
| Joined: 21 May 2016 |
| Total Posts: 5107 |
|
|
| 14 Nov 2016 07:02 AM |
http://wiki.roblox.com/index.php?title=Circle
the alternating color??
|
|
|
| Report Abuse |
|
|
| |
|
|
| 14 Nov 2016 07:06 AM |
Haven't touched Lua in a while, so you may have to correct some stuff but:
if (i % 2) == 0 then p.BrickColor = BrickColor.new(whatever) end
The modulo operator is cool. |
|
|
| Report Abuse |
|
|
Legalizes
|
  |
| Joined: 21 May 2016 |
| Total Posts: 5107 |
|
| |
|
|
| 14 Nov 2016 07:14 AM |
@Legal The modulo operator(%) returns the remainder of a division problem, and if there is no remainder, it returns 0.
So, 100 / 2 = 50. Since there's no decimal point, 100 % 2 = 0. 99 / 2 = 49.5. Since there is a decimal point, 99 % 2 = 1.
I don't recall exactly how it works out the remainder, but it should be self-explanatory if you've ever done long division without a calculator. |
|
|
| Report Abuse |
|
|
Legalizes
|
  |
| Joined: 21 May 2016 |
| Total Posts: 5107 |
|
|
| 14 Nov 2016 07:15 AM |
OK I UNDERSTAND AND JUST HOW TO MAKE THE CIRCLE CHANGE COLOR EVERY 3 SECOND?
I TRY THE LOOP P.BRICKCOLOR = BRICKCOLOR.NEW("LIME") P.BRICKCOLOR = BRICKCOLOR.NEW("rEALLY RED") etc
|
|
|
| Report Abuse |
|
|
|
| 14 Nov 2016 07:23 AM |
That's a more difficult question, and I can't exactly give a code block for it without writing your whole script for you.
Basically, you have to add the blocks to either a model or array first. Then, you iterate through the model/array changing the brickColor.
The reason you want to do this rather than just using the 'p' variable is because p is#t##own out at the end of one of the "i" things. (There are subr########### the like, but they're difficult to understand and bad for performance)
So you then need to make a new, outside loop, and then either using array functions or GetChildren(), you change the colours of the parts as needed.
to demonstrate in a barebones way:
local m = Instance.new("Model") m.Parent = workspace
for i = 1,2 do p = Instance.new("Part") p.Position = Vector3.new(0,i,0) p.Parent = m end
while wait(3) do for _,part in pairs(m:GetChildren()) do part.BrickColor = BrickColor.red end wait(3) for _,part in pairs(m:GetChildren()) do part.BrickColor = BrickColor.green end end
This should work, but again, I haven't touched Lua in a while proper, so I may have messed up somewhere. |
|
|
| Report Abuse |
|
|