Summary: Loops are useful when we want to repeat code infinitely while the condition of the loop is true, once the condition is false, it will stop the loop and continue to the code below the loop. All loops in LUAU: - for - foripairs - forpairs - while - repeat Differences between while and repeat: 1. repeat will execute ALWAYS once before checking the condition. (like the do-while loop in other languages) 2. "while" will first check the condition, then execute the code. Differencesbetween ipairs and pairs: 1. pairs is used with dicts like: { a = true, b = false, c = "something", ....... } 2. ipairs is used with arrays (indexed with numbers), like: {1, 5, "hi", false, true} These are optional to use, but it's recommended.
@Icecraxee5 ай бұрын
thx
@SimplyTutuco2 ай бұрын
We didn't learn repeat, ipars and pairs, do we learn that in a future class?
@osakadev2 ай бұрын
@@SimplyTutuco i guess so
@ItzRealImro23 күн бұрын
@@SimplyTutuco you will learn them in tables beginners tutorials basically
@shockingevacuation89954 ай бұрын
7:27 "It's still going to remain as one, and never reach this criteria." me: clicks test "--and thats going to be really bad, its going to crash your gameview if you attempt to do this." me, now staring at a roblox studio window thats not responding:
@VaIen13 ай бұрын
Same 😂😂😂
@christopherrhodes99683 ай бұрын
LOL, its best if following along to only hit test when he does as well... There should be a stop keyboard shortcut. Most languages its cmd(mac) or cntrl(windows) ^ i think. But alt+F4 should close out studio and stop the script then reopen studio and fix the code. If that doesn't work you can always hard restart the computer
@fandedeto46033 ай бұрын
SKIBIDO
@Falm33 ай бұрын
same LOL
@Tobongo3 ай бұрын
Literally me, tho I used while true do for fun. Without a wait.
@BKLanger5 ай бұрын
LETS GO I MADE A COLOR CHANGING CUBE!! IM PROUD OF MYSELFT THANK YOU
@rafaeldossantos19984 ай бұрын
how did you make that this episode was a bit confusing for me
@UserBananaIDK4 ай бұрын
@@rafaeldossantos1998watch the video and copy every line of code he does and try doing what he did
@muhammadfaizan58564 ай бұрын
@@rafaeldossantos1998 he wrote the same script but instead .Baseplate , he did .part
@LuckyDominos4 ай бұрын
It’s really easy to do by watching his videos, Atleast he is not that KZbinr that just talks about apples every video when scripting
@fujiwaranonekobiodrando12574 ай бұрын
Yo same! It even crash the first time!
@chimekpiesek2574 ай бұрын
Not sure if this was already said somewhere, but 9:05 only works 5 times because his initial value was 1. If it had been set to 0 like a person normally would do it, it would run the script 6 times because the increase only happens after the while loop is ran. To avoid it possibly messing with your other code due to the initial number being 1, do not use
@Kyoryokuna_Fallen4 ай бұрын
The way you explain things makes it very easy to understand even complicated topics. (thank you BrawlDev)
@taydoesstuff944 ай бұрын
this was the hardest tutorial to understand but i did get the hang of it
@Fynra_official6 күн бұрын
true
@couldntbeme8687Ай бұрын
local baseplate = game.Workspace.Baseplate for myCounter = 1, 10, 1 do baseplate.BrickColor = BrickColor.Random() wait(1) for myCounter2 = 1, 10, 1 do baseplate.Transparency = 1 wait(1) baseplate.Transparency = 0.8 wait(1) baseplate.Transparency = 0.6 wait(1) baseplate.Transparency = 0.4 end end
@Mr_TigglesYT27 күн бұрын
Hey guys! Quick tip: Instead of writing "myWhileCounter = myWhileCounter +1," you could write it in an easier way. Write "myWhileCounter += 1." This does the same thing as the other code, but it's a faster way of writing it. Also works for subtraction, multiplication, and division.
@WilliamEden-q6r2 ай бұрын
I've watched a bunch of scripting videos for LUA. Your tutorials are the best by far! Keep up the great work man. I appreciate you!🥇
@ElTonio20232 ай бұрын
im still not very good but here is what i made: local baseplate = game.Workspace.Baseplate task.wait(2) print("what is happening?") baseplate.BrickColor = BrickColor.new("Bright orange") task.wait(2) print("It's changing colour!") baseplate.BrickColor = BrickColor.new("Really red") task.wait(2) print("Is it over?") task.wait(2) baseplate.Anchored = false task.wait(1) print("WE ARE FALLING!")
@ElTonio20232 ай бұрын
i made another one! local part = game.Workspace.Part for myCounter = 1, 100, 1 do part.BrickColor = BrickColor.new("Really red") task.wait(0.1) part.BrickColor = BrickColor.new("Neon orange") task.wait(0.1) part.BrickColor = BrickColor.new("New Yeller") task.wait(0.1) end
@EnorMooseChannelАй бұрын
i put this inside a baseplate while true do script.Parent.BrickColor = BrickColor.new("Gold") task.wait(1) script.Parent.BrickColor = BrickColor.new("Silver") task.wait(1) script.Parent.BrickColor = BrickColor.new("Copper") task.wait(1) end
@domakrsnah1612Ай бұрын
you don't need to write "task" just write wait()
@EnorMooseChannelАй бұрын
@@domakrsnah1612 wait is actually deprecated, but I only discover it now
@EnorMooseChannelАй бұрын
@@domakrsnah1612 either ways they're the same I guess
@excerpt317425 күн бұрын
For people who are watching this and learning this (me) a very very helpful tip is to use the advance of ai like chat gpt because I was pretty confused watching this video not because he didn’t explain it well enough it’s just I didn’t get it so what I did was I prompt enhance my question using chat gpt then ask chat gpt to explain this and I read examples and explanations then give my own thoughts and back and forth until I get the idea of what it is. Like the loop I was really confused on what the numbers did like 2, 6, 2 but I asked chat GPT and I got the idea of what it means with different examples.
@Overh3ven3 күн бұрын
The AI helped out so much ty for recommending this
@smilweyboi99363 ай бұрын
I've been using studio for a couple months now and I can tell you, I almost ALWAYS forget to at least put a wait in my while loop 😅
@scratchystuff11 күн бұрын
congrats on almost 30k subs!!
@Africanbe5 ай бұрын
Bro from all the youtuber who are teaching your are from far the best at explaining keep it up dude
@noobythenoobking5 ай бұрын
question: when do you think this series is going to be over? if the series ends i might unknowingly just wait for another part to come out leaving the advanced and gui series untouched because i feel like i didnt finish this one. also, ive been looking for such simple yet working guides! thank you!
@BrawlDevRBLX5 ай бұрын
It's about 18-19 episodes. I won't be remaking the advanced and gui series so it's up to you. You can either wait till all episodes come out or watch the older 2023 beginner series. I recommend waiting for all episodes to come out.
@DeathKing789721 күн бұрын
@@BrawlDevRBLX ok
@oxerful5426Ай бұрын
local baseplate = game.Workspace.Baseplate local colourChanger = 1 while colourChanger == 1 do baseplate.BrickColor = BrickColor.Random() task.wait(1) end This series is awesome! Thank you so much it's helped immensely!
@oxerful5426Ай бұрын
To add on to this, I learned about touched functions myself, and made it so that it stops changing colour when you touch it :) local baseplate = game.Workspace.Baseplate local colourChanger = 1 local function touchyTouch() colourChanger = colourChanger + 1 end baseplate.Touched:Connect(touchyTouch) while colourChanger == 1 do baseplate.BrickColor = BrickColor.Random() task.wait(0.5) end
@Aviksz4 ай бұрын
Thanks man I’ve been trying to make my own Roblox game and this is helping so much I remember everything and it’s actually easy
@naizo11892 ай бұрын
I love your videos man keep up the good work
@MrChicken-db1ms3 ай бұрын
finally a actually good tutorial series
@materwelone60264 ай бұрын
I'm just skimming through this video since I just need a refresher on lua but this is a cool for loop exercise that makes a square -- Nested for loop for row = 1,10 do -- Will iterate 10 times (simulating 10 rows) for column = 1,10 do -- Will iterate 10 except this time its columns local part = Instance.new("Part") -- This is just how you make a part part.Parent = workspace part.Anchored = true part.Size = Vector3.new(1,1,1) -- Size is set to a 1x1 cube to make positioning easier part.Position = Vector3.new(row,0,column) end end
@eyadosama43812 ай бұрын
calm down we still dont know these things😐
@EnorMooseChannelАй бұрын
@@eyadosama4381 Vector is position, Anchored means wether the object is unmovable or movable, or let just say anchored. Instance means creating something
@Cannonplaylol3 ай бұрын
making the baseplate change colors is really fun
@T4MIL0RE_09Ай бұрын
guys can someone please help me with the for loops part cuz i really dont understand the explanation of having the three numbers like i dont know whats the point of them no matter how many times i rewatch the video. 😔😭
@InidiumIsCoolАй бұрын
U don't need more than 1 I dunno why he did that
@Ulysses.15 ай бұрын
For the learning objective I did: basePlate = game.Workspace.Baseplate while true do -- While true does a infinite loop which could be useful red = math.random(1,255) -- uses math.random for a pseudo randomization of the rgb coordinate green = math.random(1,255) blue = math.random(1,255) basePlate.Color = Color3.new(red,green,blue) -- places in the randomizations of the rgb coords to generate random colors task.wait(0.5) -- has to wait so that the code doesn't break and stops at one color. end
@aapple79935 ай бұрын
-- Randomizes baseplate color and counts how many randomizations have happendd and prints them. local baseplate = game.Workspace.Baseplate counter = 0 while true do counter = counter + 1 print('Color ',counter) -- Inner loop for i = 1, 10 do red = math.random(1, 255) green = math.random(1, 255) blue = math.random(1, 255) baseplate.Color = Color3.new(red,green,blue) end wait(1) end
@ClavedEdits19 күн бұрын
i made a timer & countdown with for loops local function timer(thetime) for timer= 1, thetime, 1 do print(stopwatch) task.wait(1) end end timer(5) local function countdown(thetime) for countdown = thetime, 1, -1 do print(countdown) task.wait(1) end end countdown(5) and also here is nestled loops that changes the baseplate transparency local plate = game.Workspace.Baseplate plate.Transparency = 0.5 for baseplate = 1, 5, 1 do plate.Transparency -= 0.5 print("the value has decreased!") task.wait(1) for baseplate2 = 1,5, 1 do plate.Transparency += 0.1 print("the value has increased!") task.wait(1) end end i would def say this was actually like the BEST and FUN tutorial/episode by far in this series
@Anonymous_still5 ай бұрын
commenting just to boost your channel
@sammyawad49335 ай бұрын
15:29 i just do wait() instead. same result. also before this tutorial i was messing around with the same thing and making a flashbang of colors ( 0 cooldown and neon)
5 ай бұрын
Yeah but I seen on the dev forum that apparently Task.Wait, is more accurate and newer but idk I havent seen anything wrong
@oberonpanopticon5 ай бұрын
I’ve started kinda skipping through this series because I already know most of the basic computer science, I’m just wondering when he’ll get into user input / player interaction. Because most scripts aren’t very useful if there’s no way for a player to interact with/trigger them
@0n0rchy4 ай бұрын
bro really? computer science?
@SouradiptaPlays3 ай бұрын
@@0n0rchy i think he means like the basic programming concepts like if statements, loops, variables, etc. :)
@charlieroberts1352Ай бұрын
Also thankyou so much for making this tutorials its so helpfull
@nightcatyoutubeАй бұрын
hey brawldev can you explain a little more about the last number on the for myCounter = 1, 5, 1
@CalebAdeyemoАй бұрын
The last number is the number that your for loop increments by. Like the one BrawlDev showed us 1, 5, 1. You start on the number 1 and end on 5. Number 1 at the end is how much the for loop increases by each time. If you made that a 2 it wouldn't work because 2 can't be divided into 5. I hope this helps!
@IngeFersTe25 күн бұрын
I used loops, functions and if statement to change the objects transparencty. First I changed it with for loops then with while loops. Here is the script if you want to test and check it out: local testObject = game.Workspace.TestObject local test = 0 local test2 = 0 local function changeTransparency(value) testObject.Transparency = testObject.Transparency + value end for i = 1, 10, 1 do changeTransparency(0.1) wait(0.1) if i == 10 then print("Object is transparent, changing back") wait(3) for i2 = 1, 10, 1 do changeTransparency(-0.1) wait(0.1) end end end print("Your object is now visible, proceeding to do the same with while loop") wait(3) while test
@mari.87e5 ай бұрын
FIRST COMMENR AND UR VIDEOS R AMAZING KEEP POSTING DUDE!
@dulipa87274 ай бұрын
no one cares if you're "first"
@TANER8452 ай бұрын
7:38 yeah i should have probaly finsh before trying it my self
@jasondiop17043 ай бұрын
Since I had a bit of trouble learning the for loop, ill explain it here, the second number is how many times the loop will go BUT, the third number tells how many increments it goes it, and the first number is the number it begins at, for example "for myCount 0.5, 5, 0.5" the first number is the number it begins at, then the third number is how much it goes up each time until it reached the second number, in this case, the loop goes 10 times
@TimmyrobloxАй бұрын
Thank you it’s very clear now because I’m not very good at English so yeah xdd
@diamondsminer1239Күн бұрын
7:36 If u said that one second earlier I wouldn't have crashed LOL
@goodnoob8574 ай бұрын
I have skills with python, but I like to create games in roblox studio so I will learn lua from you thanks
@DA-hd7vt2 ай бұрын
protect this guy at all costs
@MR-VOXELATOR117Ай бұрын
This is a code i made from all the concepts i have learned till now: local cookies = 5 if cookies == 2 + 3 then local changer = game.Workspace.Baseplate changer.BrickColor = BrickColor.new("Toothpaste") task.wait(1) changer.BrickColor = BrickColor.new("Cocoa") task.wait(1) changer.BrickColor = BrickColor.new("Faded green") task.wait(1) else print("sucker cant do maths") end local function cookies() print("statement A") print("statement B") print("statement C") print("statement D") print("statement E") print("statement F") end cookies() for rtat = 1, 5, 1 do print(2 + 2) end task.wait(10) game.Workspace.Baseplate.Anchored = false
@BKLanger5 ай бұрын
If anyone was wondering heres what I've learned after watching the video- Making and infinitely color changing cube. local Cube = script.Parent wait(5) while true do for cubeColor = 1, 1, 1 do Cube.BrickColor = BrickColor.new("Really red") task.wait(0.5) Cube.BrickColor = BrickColor.new("Neon orange") task.wait(0.5) Cube.BrickColor = BrickColor.new("New Yeller") task.wait(0.5) Cube.BrickColor = BrickColor.new("Lime green") task.wait(0.5) Cube.BrickColor = BrickColor.new("Bright blue") task.wait(0.5) Cube.BrickColor = BrickColor.new("Royal purple") task.wait(0.5) end end
@daniel_denamit7244 ай бұрын
yooo realy cool and realy easy to understand
@eeScore2 ай бұрын
i put a script in a part that makes the part disappear and reappear like in a timed jump minigame while true do script.Parent.Transparency = 0 script.Parent.CanCollide = true task.wait(0.35) script.Parent.Transparency = 1 script.Parent.CanCollide = false task.wait(0.35) end
@korudo8553 ай бұрын
can anyone explain to me a bit more on what the 3rd number does? 4:19
@Yennifelipe3 ай бұрын
3rd num +/- 1st num so, completes a loop and it plus 1 till it reaches 5, or at 9:55 3rd num is -1 so it -1 from 5 till it reaches 1. Hope it makes sense
@suprisedbeeiscute3 ай бұрын
not mentioning the ''while true do'' loop is a crime
@Isostraight3 ай бұрын
yes, I was bouta say. that's like the only one I knew how to do previously to these videos lol
@suprisedbeeiscute3 ай бұрын
@@Isostraight that's the only thing at all I knew how to do before this
@SimplyTutuco2 ай бұрын
It's the same as defining any variable to true and doing while ThatOneVariable = true do
@Bizop99Ай бұрын
He doesn't need to, true and false are just other data type that can be used within a while loop.
@FunStuffOTW25 күн бұрын
expanded a bit on the script in the video, just made a function with a while loop that goes from 1 to 5, changing the color of the baseplate to a random color every .2 seconds, then sets the whilecounter back to 1. then i put this function in between each of our previously stated for loop, making it a function nested loop? idk but its fun. local baseplate = game.Workspace.Baseplate local whileCounter = 1 local function RandomFast() while whileCounter < 5 do baseplate.BrickColor = BrickColor.random() task.wait(0.2) whileCounter = whileCounter + 1 end whileCounter = 1 end for myCounter = 1, 10, 1 do baseplate.BrickColor = BrickColor.new("Toothpaste") task.wait(3) RandomFast() baseplate.BrickColor = BrickColor.new("Lime green") task.wait(3) RandomFast() baseplate.BrickColor = BrickColor.new("Gold") task.wait(3) RandomFast() end
@TheMoonlighty4 ай бұрын
Thanks! i rlly love what i have done just now!!!!
@liutenant-blob_pond2 ай бұрын
for Clant = 1, 1000, 1 do print('you completed lesson goal for episode 11; this will repeat every second') task.wait(1) print("thsi is used to prevent the out from using ###(x#) format") task.wait(1) end
@logikdemon4107Ай бұрын
Hey BrawlDev, why is my script not working? local myCounter = 1 wait (3) for myCounter = 1, 10, 1 do myCounter = myCounter + 1 print("Next number") wait(1) end if myCounter == 10 then myCounter = myCounter + 1 print("+1") wait(1) end I expected to make it count to 10. If it reaches 10, it should increment its number everytime by 1 every second
@YCre4tor18 күн бұрын
7:30, yes I noticed that... about 30 seconds ago.
@MrPicklekvGygAАй бұрын
My homework makes a part slow fade away, becoming intangible when it is invisible: local part = game.Workspace.Part while part.Transparency 1 then part.CanCollide = false end end
@WhoLetsBludCookАй бұрын
Why does dawg explain it so well
@market44574 ай бұрын
local myWhileCounter = 1 while myWhileCounter >= 5 do print("Crazy?") task.wait(0.5) print("I was crazy once") task.wait(0.5) print("They locked me in a room") task.wait(0.5) print("A rubber room") task.wait(0.5) print("A rubber room with rats") task.wait(0.5) print("And rats make me crazy") task.wait(0.5) myWhileCounter = myWhileCounter+1 end
@atotallylazyperson3 ай бұрын
Also for the while true do you can just put a task.wait(any number that isnt too low here) before your script to prevent it from crashing if you want to make an indefinite loop for some reason but it will still crash eventually if your script is like an instance.new(“part”) and wont destroy any old parts
@Bowbers8 күн бұрын
I appreciate these videos they're really helpful for a noob such as myself local spectral = game.Workspace.TestSubject local function plant(n1, n2) local pathFinder = n1 + n2 if pathFinder == 12 then for mycounter = 1, 10 , 1 do spectral.Color = Color3.new(0.333333, 1, 1) spectral.Material = Enum.Material.Brick task.wait(1) spectral.Color = Color3.new(0.666667, 0, 0) spectral.Material = Enum.Material.Asphalt task.wait(1) spectral.Color = Color3.new(0, 1, 0) spectral.Material = Enum.Material.Pebble task.wait(1) spectral.Color = Color3.new(1, 1, 0.498039) spectral.Material = Enum.Material.Grass task.wait(1) spectral.Color = Color3.new(0, 0, 1) spectral.Material = Enum.Material.Brick task.wait(1) end else local result2 = false print(result2) end end plant(10, 2)
@atotallylazyperson3 ай бұрын
Dudeeee tysm i made a gambling game where there everytime you join there is a 4/5 chance to kick you with a bruh sound effect and a 1/5 you stay and it will spawn a bunch ofgreen bricks (money) on the spawnpoint with register sounds for like 10 seconds and then kicks you saying something like “you won” i used your vids in combination with google searches and dev forum
@Tifferthegreat4 ай бұрын
I made a script that makes the baseplate smoothly blink from transparent to non transparent like this: local baseplate = game.Workspace.Baseplate for MyCounter = 1, 10, 1 do for Counter = 1, 10, 1 do baseplate.Transparency = baseplate.Transparency + 0.1 task.wait(0.1) end for Counter2 = 1, 10, 1 do baseplate.Transparency = baseplate.Transparency - 0.1 task.wait(0.1) end end you can try it out yourself if you want :D
@thetruebigfloppa14 күн бұрын
not sure if i did enough but i should definitely practice this anyways: for myCounter = 1, 3, 1 do print("For every time this statement is stated, another statement is stated 5 times") for myCounter2 = 1, 5, 1 do print("The statement above is correct") end end local auraLevel = 1000 while auraLevel 9000 then print("HIS POWER LEVEL IS OVER 9000") end end
@Patgad-M815Ай бұрын
just a question but what does print do in games? Sorry if this question was already asked or just straight up stupid :)
@QanGaming69420Ай бұрын
I am loving these episodes, they are so easy to understand. Here are my scripts btw, and what i did was i made multiple different items in my world to keep changing colors infinitely. I made them the same colors though, so they were aligned in the same pattern. local plate = game.Workspace.Baseplate while 1 == 1 do plate.BrickColor = BrickColor.new("Lapis") wait (0.2) plate.BrickColor = BrickColor.new("Toothpaste") wait (0.2) plate.BrickColor = BrickColor.new("Lime green") wait (0.2) plate.BrickColor = BrickColor.new("Deep orange") wait (0.2) plate.BrickColor = BrickColor.new("Really red") wait (0.2) end -------------- local part = game.Workspace.ThePart while 1 == 1 do part.BrickColor = BrickColor.new("Lapis") wait (0.2) part.BrickColor = BrickColor.new("Toothpaste") wait (0.2) part.BrickColor = BrickColor.new("Lime green") wait (0.2) part.BrickColor = BrickColor.new("Deep orange") wait (0.2) part.BrickColor = BrickColor.new("Really red") wait (0.2) end ------------- local spawnpoint = game.Workspace.SpawnLocation while 1 == 1 do spawnpoint.BrickColor = BrickColor.new("Lapis") wait (0.2) spawnpoint.BrickColor = BrickColor.new("Toothpaste") wait (0.2) spawnpoint.BrickColor = BrickColor.new("Lime green") wait (0.2) spawnpoint.BrickColor = BrickColor.new("Deep orange") wait (0.2) spawnpoint.BrickColor = BrickColor.new("Really red") wait (0.2) end
@diwalkersp29903 ай бұрын
Just asking why would you need all of the different types if they all do the same thing?
@nzm_f64252 ай бұрын
Coding is a logical computer language. Who knows what problem may occur, more option is better for that case in my opinion
@DesyeditzАй бұрын
local red = game.Workspace.policeRed local blue = game.Workspace.policeBlue local function alternatingLights() red.Transparency = 0.8 if red.Transparency >= 0.8 then blue.Transparency = 0 blue.Material = "Neon" end wait(0.5) if red.Transparency >= 0.8 then red.Transparency = 0 red.Material = "Neon" blue.Material = "Plastic" blue.Transparency = 0.8 end wait(0.5) if blue.Transparency >= 0.8 then red.Transparency = 0.8 end end for lightChange = 1, 10000000, 1 do alternatingLights() end this code is used to make two blocks one red and one blue switch between on and off to simulate a police siren effect love ur videos man
@Saydayso5 ай бұрын
TYSM BrawlDev:D
@mr.crazycatlover131218 күн бұрын
How would you make a loop that continues until a variable is true of false for example
@MorsaTactica4 ай бұрын
Before starting the tutorial i only known how to print, but now i am a true proffesional, Thanks!
@الخلبوصة5 ай бұрын
Random question. If I re-uploaded your channel profile picture to Roblox under my account, will you file a DMCA takedown?
@SoyzsАй бұрын
Heres my code i know it can be shortened but i haven't grasped the capabilities to do so yet... It changes the color of the Baseplate like in the video (with different colors), prints out words, and changes several parts colors when the baseplate color changes, after a second passes it changes to the original color of the part which was a lavender, green and blue and repeats the process eventually stopping. local baseplate = game.Workspace.Baseplate local part1 = game.workspace.Part1 local part2 = game.workspace.Part2 local part3 = game.workspace.Part3 for myCounter = 1, 10, 1 do --The counter and increments and values of such baseplate.BrickColor = BrickColor.new("Deep blue") --Changes baseplate color print ("Color Changed to: Blue!") -- prints out that the Color has been changed part1.BrickColor = BrickColor.new("Deep blue") --Changes a parts color along with the baseplate part3.BrickColor = BrickColor.new("Lavender") task.wait(1) -- Waits one second baseplate.BrickColor = BrickColor.new("Tawny") print ("Color Changed to: Tawny!") part1.BrickColor = BrickColor.new("Bright green") -- Changes color back to original color part2.BrickColor = BrickColor.new("Tawny") task.wait(1) baseplate.BrickColor = BrickColor.new("Gold") print ("Color Changed to: Gold!") part3.BrickColor = BrickColor.new("Gold") part2.BrickColor = BrickColor.new("Storm blue") task.wait(1) --Task.Wait at the end so that it can properly wait before the next iteration end
@Qualet-h7m10 күн бұрын
changed the material local baseplate = game.Workspace.Baseplate for mC = 1, 100,1 do baseplate.Material = "Limestone" task.wait(1) baseplate.Material = "Marble" task.wait(1) baseplate.Material = "Plastic" task.wait(1) end
@gapperss22 күн бұрын
-- First Loop local function add(n1, n2) local answer = n1 + n2 if answer == 100 then print("its alr 100??") end local answer1 = answer + 1 while not (answer1 == 100) do print(answer1) wait(0.01) answer1 = answer1 + 1 print(answer1) if answer1 == 100 then print("Its one hundred!!!!!") end end end add(1, 1)
@nahidwin-mn1ij2 ай бұрын
16:58 done yessir ---- just messing around aka just doing da learning objective -- messing with while loops local gp = game.workspace.GreenPart local loop = 1 while loop
@rodneysot4 ай бұрын
so here's my script utilizing the for loop the nestled loop and the while loop it just prints some stuff and changes the material of a part to neon the anchored to true and the cancollide to false if a certain condition is met. local part = game.workspace.Balloon for part = 1, 5, 1 do print("part") for part2 = 1, 5, 1 do print("part2") end end local burgers = 5 while burgers >= 5 do part.Material = 'Neon' task.wait(2) part.Anchored = true task.wait (2) part.CanCollide = false task.wait(1) end
@Darkness_1-y1w4 ай бұрын
I went kinda crazy with this one... Its a part that will change color in a rainbow order and within each color change, it changes the material 9 times within 3 materials and the colour in rainbow order happens 60 times I think it changes a total of 540 times if my math is right... sooo let me just show it 😄 local part = game.Workspace.Part for myCounter = 1, 10, 1 do part.BrickColor = BrickColor.new("Really red") task.wait(1) for myCounter2 = 1, 3, 1 do part.Material = Enum.Material.Neon task.wait(1) part.Material = Enum.Material.Wood task.wait(1) part.Material = Enum.Material.CrackedLava task.wait(1) end part.BrickColor = BrickColor.new("Neon orange") task.wait(1) for myCounter2 = 1, 3, 1 do part.Material = Enum.Material.Neon task.wait(1) part.Material = Enum.Material.Wood task.wait(1) part.Material = Enum.Material.CrackedLava task.wait(1) end part.BrickColor = BrickColor.new("New Yeller") task.wait(1) for myCounter2 = 1, 3, 1 do part.Material = Enum.Material.Neon task.wait(1) part.Material = Enum.Material.Wood task.wait(1) part.Material = Enum.Material.CrackedLava task.wait(1) end part.BrickColor = BrickColor.new("Lime green") task.wait(1) for myCounter2 = 1, 3, 1 do part.Material = Enum.Material.Neon task.wait(1) part.Material = Enum.Material.Wood task.wait(1) part.Material = Enum.Material.CrackedLava task.wait(1) end part.BrickColor = BrickColor.new("Deep blue") task.wait(1) for myCounter2 = 1, 3, 1 do part.Material = Enum.Material.Neon task.wait(1) part.Material = Enum.Material.Wood task.wait(1) part.Material = Enum.Material.CrackedLava task.wait(1) end part.BrickColor = BrickColor.new("Royal purple") task.wait(1) for myCounter2 = 1, 3, 1 do part.Material = Enum.Material.Neon task.wait(1) part.Material = Enum.Material.Wood task.wait(1) part.Material = Enum.Material.CrackedLava task.wait(1) end end
@bobuxcartel40513 ай бұрын
this part repeats a lot so you could make it a function to shorten your script task.wait(1) for myCounter2 = 1, 3, 1 do part.Material = Enum.Material.Neon task.wait(1) part.Material = Enum.Material.Wood task.wait(1) part.Material = Enum.Material.CrackedLava task.wait(1) Ex: local part = game.Workspace.Part local function myFunction() task.wait(1) for myCounter2 = 1, 3, 1 do part.Material = Enum.Material.Neon task.wait(1) part.Material = Enum.Material.Wood task.wait(1) part.Material = Enum.Material.CrackedLava task.wait(1) end end for myCounter = 1, 10, 1 do part.BrickColor = BrickColor.new("Really red") myFunction() part.BrickColor = BrickColor.new("Neon orange") myFunction() part.BrickColor = BrickColor.new("New Yeller") myFunction() part.BrickColor = BrickColor.new("Lime green") myFunction() part.BrickColor = BrickColor.new("Deep blue") myFunction() part.BrickColor = BrickColor.new("Royal purple") myFunction() end
@GTEditsOfficial3 ай бұрын
how do you do this I don’t remember anything from the past episodes
@MrTazx26 күн бұрын
8:04 I already did this I guess I predicted the future lol
@Mike_Ehrmantraut5 күн бұрын
I just found a way to optimize the code that I posted back in the if statement video local atmosphere = game.Lighting.Atmosphere for counter = 0, 0.80, 0.01 do atmosphere.Density = counter wait(0.01) end
@PowerfulSpeakerman4 ай бұрын
how do you apply this when you get to real scripting? and not just showing up on the output?
@pryt0n1804 ай бұрын
That's the neat part, you don't.
@SimplyTutuco2 ай бұрын
@@pryt0n180 You do, but later
@SimplyTutuco2 ай бұрын
You do, but later.
@0n0rchy4 ай бұрын
--HERE a short note I made for my self I hope this willl be useful for you guys too :DD -first one is starting point next one is ending point next one is step for myValue = 1, 5, 1 do print("For loop 1: ",myValue) end --while loop with some variables :DDD local myWhileLoop = 1 while myWhileLoop
@mokieaaa4 ай бұрын
have you gained 500 subscribers in one day? yesterday I feel like you were at 9.6k!
@mryochikanАй бұрын
How does the 1, 5, 1 thing work? srry cuz im dutch and english is not my native language XD
@BHG59425 күн бұрын
a script that just changes a part and loops local msg = game.Workspace.Part local r = game.Workspace.Part local e = game.Workspace.Part local s = game.Workspace.Part local d = game.Workspace.Part local n = game.Workspace.Part msg.Material = "Grass" wait(3) r.Material = "Metal" wait(2) e.Material = "Mud" wait(2) s.Material = "Leather" wait(2) d.Material = "Snow" wait(2) n.Material = "Neon" wait(1) for mc = 10, 10 , 10 do print("y") print("y") print("y") print("y") print("y") print("y") print("y") print("y") print("y") print("y") print("y") print("y") print("y") print("y") print("y") print("y") print("y") print("y") end local myh = 1 while myh
@boxblox19865 ай бұрын
meh notes for aCounter = 1,2,1 do - - the first *1* is what you start with print("statement 1") - - the *2* is the maximum print("statement 2")- - the second *1* is how much it adds up per loop end local aWhileCounter = 1 - - what you start with while aWhileCounter
@boxblox19864 ай бұрын
@chonkmilky np it’s just my notes throughout this video
@charlieroberts1352Ай бұрын
Does anyone know how to make it onfinitly change color For exaple [for myCounter = 1, 10, 1 do] Would it be like [for myCounter = 1, 99999999999999, 1] ?
@miguelitto9993 ай бұрын
local baseplate = game.Workspace.Baseplate for color = 1, 100, 1 do baseplate.BrickColor = BrickColor.Random() task.wait(0.1) end it makes a colorful baseplate
@hagamer3214Күн бұрын
this is the hardest one yet but living through it i dont understand it fully
@jasutasu3 ай бұрын
having trouble understanding the 1, 5, 1. Even asked gpt to break it down and still don't understand
@nzm_f64252 ай бұрын
C++ may be able to explain it more detail. In C++ it is for (int i = 1; i
@ItsBloxyDude26 күн бұрын
I have question, what is the use of task? When I say wait(insert number here) it works?
@thetipher11 күн бұрын
local rizz = game.Workspace.rizz local fp = game.Workspace.FunctionPart for change = 1, 2, 1 do fp.BrickColor = BrickColor.Random() task.wait(1) for secondChange = 1, 12, 1 do rizz.BrickColor = BrickColor.Random() task.wait(1) print("Working!") task.wait(1) end end
@AbdulMezooghi5 ай бұрын
Your amazing at teaching
@psremoteaccАй бұрын
at the start i roght: while true do print("yup") end wicht then crashes roblox studios and to fix that you have to put a wait()
@FafayelAhmed3 ай бұрын
local part = game.Workspace.Part if part.Anchored == false then do part.Anchored = true print("Part has been anchored") end end for myCounter = 1, 10, 1 do part.Material = Enum.Material.Wood task.wait(1) part.Material = Enum.Material.RoofShingles task.wait(1) part.Material = Enum.Material.Brick task.wait(1) print("The material has been changed") task.wait(1) end
@ElementalClips119 күн бұрын
if 3 + 3
@Realplayer-tu7gyАй бұрын
every step counts. while true do local x = math.random(1, 1000) local y = math.random(10, 30) local z = math.random(1, 1000) local bp = game.Workspace.Baseplate bp.Size = Vector3.new(x, y, z) wait(0) end
@jordyyn5 ай бұрын
one of the best scripting tutorials out there, thanks
@aversus02 ай бұрын
Hi BrawlDev, I'm really enjoying this series as I've learnet so much. I was wondering if you could help me with this bit of code? Every second I want the code to change the basePlates colour to a randomly generated one. This is what I've done so far but the code isn't repeating for some reson (the random colour genorator does work though). local basePlate = script.Parent value1 = math.random(1,255) value2 = math.random(1,255) value3 = math.random(1,255) for myCounter = 1, 1000, 1 do basePlate.Color = Color3.fromRGB(value1,value2,value3) task.wait(1) end
@ReversePortal2 ай бұрын
The three values are outside the loop, so they are only randomized once
@aversus02 ай бұрын
@@ReversePortal 👍🏻
@ReversePortal2 ай бұрын
@@aversus0 🤓👍
@influxional2 ай бұрын
im so fucking slow 😭😭😭😭 ive watched this 2-3 times already and yet i still dont understand everything
@salavor1Ай бұрын
while whileloop
@ShinyLittenvr19 күн бұрын
I love crashing python idle shell using wire loops ( while True: print(“hi”)
@SimplyTutuco2 ай бұрын
Yippee, we are back to messing with the in-game object and not just the output! :D (output was fun too, but I was getting tired of it) My LO: local lava = game.Workspace.CrackedLavaPart local someVariable = 1 local marble = game.Workspace.MarblePart local function animateLava() while someVariable
@andreyromashchenko89672 ай бұрын
I came to see how to loop thru folder’s “children”, to turn all the parts inside that folder into a different material. :(
@InspiredByME-x1tАй бұрын
Awesome tutorial, heres what I did with it: local colorChange = game.Workspace.Part for wowAnotherColor = 1, 355, 1 do colorChange.BrickColor = BrickColor.random() task.wait(.7) for wowAnotherColor2= 1, 1, 1 do colorChange.Transparency = math.random() task.wait(.8) end end
@B0MSH1KАй бұрын
Thanks for this helpful video and here is my learning objective! :) local changeCubeColor = game.Workspace.Cube local changeCubeTransparency = game.Workspace.Cube for Cubecolorchangerloop = 1, 10, 1 do changeCubeColor.Color = Color3.new(165/255, 0/255, 0/255) changeCubeTransparency.Transparency = .5 task.wait(1) changeCubeColor.Color = Color3.new(0.647059, 0.611765, 0.145098) changeCubeTransparency.Transparency = 0 task.wait(1) end
@Realplayer-tu7gyАй бұрын
i could just leave this 17 MINUTES video but its too good
@daikuhugs4 ай бұрын
After combining vid 2 - 11 and 5-10 mins of troubleshooting this is what i made local Part = game.Workspace["Block 1"] for counter = 1, 10, 1 do wait(5) local a = math.random(1,200) local result = a if a >= 50 and a = 101 and a