Loops - Roblox Beginners Scripting Tutorial #11 (2024)

Поделиться
HTML-код
  • Опубликовано: 13 янв 2025

Комментарии • 741

  • @osakadev
    @osakadev 6 месяцев назад +152

    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.

    • @Icecraxee
      @Icecraxee 6 месяцев назад +5

      thx

    • @SimplyTutuco
      @SimplyTutuco 3 месяца назад +1

      We didn't learn repeat, ipars and pairs, do we learn that in a future class?

    • @osakadev
      @osakadev 3 месяца назад

      @@SimplyTutuco i guess so

    • @ItzRealImro
      @ItzRealImro Месяц назад

      @@SimplyTutuco you will learn them in tables beginners tutorials basically

    • @AlexanderEdwards-x8e
      @AlexanderEdwards-x8e 3 дня назад

      Question, I understand while loops but not the for loops, can someone explain them to me in plain English?

  • @shockingevacuation8995
    @shockingevacuation8995 4 месяца назад +101

    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:

    • @OupsdAdri
      @OupsdAdri 4 месяца назад +5

      Same 😂😂😂

    • @christopherrhodes9968
      @christopherrhodes9968 4 месяца назад

      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

    • @fandedeto4603
      @fandedeto4603 4 месяца назад

      SKIBIDO

    • @Falm3
      @Falm3 4 месяца назад +1

      same LOL

    • @Tobongo
      @Tobongo 3 месяца назад +2

      Literally me, tho I used while true do for fun. Without a wait.

  • @Mr_TigglesYT
    @Mr_TigglesYT Месяц назад +33

    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.

    • @barthamuel
      @barthamuel 12 дней назад

      goat

    • @AlexanderEdwards-x8e
      @AlexanderEdwards-x8e 3 дня назад

      Question, I understand while loops but not the for loops, can someone explain them to me in plain English?

    • @mxrz0q
      @mxrz0q 3 дня назад

      @AlexanderEdwards-x8e
      for myCounter =1, 20, 5 do
      print("something")
      end
      this contains: for, variable name(could be anything), = (equals to), and the numbers after it are basically starting value, end value, how much its going to count every time.
      in the example i gave you its going to print "something" 4 times because we start at 1, out goal is to each 20 and every time we are counting +5.

  • @BKLanger
    @BKLanger 5 месяцев назад +138

    LETS GO I MADE A COLOR CHANGING CUBE!! IM PROUD OF MYSELFT THANK YOU

    • @rafaeldossantos1998
      @rafaeldossantos1998 5 месяцев назад +7

      how did you make that this episode was a bit confusing for me

    • @UserBananaIDK
      @UserBananaIDK 5 месяцев назад

      @@rafaeldossantos1998watch the video and copy every line of code he does and try doing what he did

    • @muhammadfaizan5856
      @muhammadfaizan5856 5 месяцев назад +5

      @@rafaeldossantos1998 he wrote the same script but instead .Baseplate , he did .part

    • @LuckyDominos
      @LuckyDominos 4 месяца назад +10

      It’s really easy to do by watching his videos, Atleast he is not that RUclipsr that just talks about apples every video when scripting

    • @fujiwaranonekobiodrando1257
      @fujiwaranonekobiodrando1257 4 месяца назад +1

      Yo same! It even crash the first time!

  • @taydoesstuff94
    @taydoesstuff94 5 месяцев назад +18

    this was the hardest tutorial to understand but i did get the hang of it

  • @chimekpiesek257
    @chimekpiesek257 5 месяцев назад +14

    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

    • @AlexanderEdwards-x8e
      @AlexanderEdwards-x8e 3 дня назад

      Question, I understand while loops but not the for loops, can someone explain them to me in plain English?

    • @WhenAllTheWarmthLeavesUs
      @WhenAllTheWarmthLeavesUs 2 дня назад

      @AlexanderEdwards-x8e For loops will basically execute a loop of command(s) for a number of times, or indefinitely. Follow the example:
      1. for myVariable = 1, 5, 1 do
      2. print("Hello!")
      3. end
      When we look at line 1, you started with the "for", which means you want a "for loop", then you defined the variable's conditions, which are, in order:
      1, 5, 1 -- With the first "1" being the starting value; the "5" being the end value; and the last "1" being how much it's going to count every time the command executes and prints the "Hello!".
      When it has executed itself sufficient times to the starting value be equal to the end value, it will end the loop.

  • @Kyoryokuna_Fallen
    @Kyoryokuna_Fallen 4 месяца назад +9

    The way you explain things makes it very easy to understand even complicated topics. (thank you BrawlDev)

  • @WilliamEden-q6r
    @WilliamEden-q6r 3 месяца назад +1

    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!🥇

  • @socalled-chickenman
    @socalled-chickenman 4 месяца назад +10

    not mentioning the ''while true do'' loop is a crime

    • @Isostraight
      @Isostraight 4 месяца назад +2

      yes, I was bouta say. that's like the only one I knew how to do previously to these videos lol

    • @socalled-chickenman
      @socalled-chickenman 4 месяца назад +1

      @@Isostraight that's the only thing at all I knew how to do before this

    • @SimplyTutuco
      @SimplyTutuco 3 месяца назад

      It's the same as defining any variable to true and doing
      while ThatOneVariable = true do

    • @Bizop99
      @Bizop99 2 месяца назад +1

      He doesn't need to, true and false are just other data type that can be used within a while loop.

  • @Jojo084k
    @Jojo084k 6 месяцев назад +5

    Bro from all the youtuber who are teaching your are from far the best at explaining keep it up dude

  • @ClavedEdits
    @ClavedEdits Месяц назад +1

    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

  • @noobythenoobking
    @noobythenoobking 6 месяцев назад +6

    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!

    • @BrawlDevRBLX
      @BrawlDevRBLX  6 месяцев назад +3

      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.

    • @DeathKing7897
      @DeathKing7897 Месяц назад

      @@BrawlDevRBLX ok

  • @naizo1189
    @naizo1189 3 месяца назад +1

    I love your videos man keep up the good work

  • @smilweyboi9936
    @smilweyboi9936 4 месяца назад +2

    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 😅

  • @DavidKozyan
    @DavidKozyan 4 месяца назад +6

    i made a traffic light!!!

    • @Skelzy_7
      @Skelzy_7 Месяц назад +1

      Glad to hear.

  • @Aviksz
    @Aviksz 5 месяцев назад +2

    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

  • @MisMatch1234
    @MisMatch1234 11 дней назад +2

    Thanks to your series I decided to challenge myself by making a little minigame! Took a lot of thinking and bug fixing but I did it! I am well aware this code could be cleaner but I haven't gotten to tables yet. This is a simple minigame where 3 of 4 parts turn red and dissapear and your goal is to jump to the one platform that stays before the other dissapear. The game gets faster overtime and maxes out at a 1 second per round.
    Note: The script and parts are in a folder called Parts
    local part1 = script.Parent.Part1
    local part2 = script.Parent.Part2
    local part3 = script.Parent.Part3
    local part4 = script.Parent.Part4
    local timer = 3
    local function STAGE4()
    part1.BrickColor = BrickColor.new("Really red")
    part2.BrickColor = BrickColor.new("Really red")
    part3.BrickColor = BrickColor.new("Really red")
    task.wait(timer)
    part1.Transparency = 1
    part1.CanCollide = false
    part2.Transparency = 1
    part2.CanCollide = false
    part3.Transparency = 1
    part3.CanCollide = false
    task.wait(timer)
    end
    local function STAGE1()
    part4.BrickColor = BrickColor.new("Really red")
    part2.BrickColor = BrickColor.new("Really red")
    part3.BrickColor = BrickColor.new("Really red")
    task.wait(timer)
    part4.Transparency = 1
    part4.CanCollide = false
    part2.Transparency = 1
    part2.CanCollide = false
    part3.Transparency = 1
    part3.CanCollide = false
    task.wait(timer)
    end
    local function STAGE3()
    part1.BrickColor = BrickColor.new("Really red")
    part2.BrickColor = BrickColor.new("Really red")
    part4.BrickColor = BrickColor.new("Really red")
    task.wait(timer)
    part1.Transparency = 1
    part1.CanCollide = false
    part2.Transparency = 1
    part2.CanCollide = false
    part4.Transparency = 1
    part4.CanCollide = false
    task.wait(timer)
    end
    local function STAGE2()
    part1.BrickColor = BrickColor.new("Really red")
    part4.BrickColor = BrickColor.new("Really red")
    part3.BrickColor = BrickColor.new("Really red")
    task.wait(timer)
    part1.Transparency = 1
    part1.CanCollide = false
    part4.Transparency = 1
    part4.CanCollide = false
    part3.Transparency = 1
    part3.CanCollide = false
    task.wait(timer)
    end
    local function RESET()
    part1.BrickColor = BrickColor.new("Medium stone grey")
    part2.BrickColor = BrickColor.new("Medium stone grey")
    part3.BrickColor = BrickColor.new("Medium stone grey")
    part4.BrickColor = BrickColor.new("Medium stone grey")
    part1.Transparency = 0
    part1.CanCollide = true
    part2.Transparency = 0
    part2.CanCollide = true
    part3.Transparency = 0
    part3.CanCollide = true
    part4.Transparency = 0
    part4.CanCollide = true
    task.wait(timer)
    end
    function Subtract()
    if timer > 0.5 then
    timer = timer - 0.5
    else
    timer = 0.5
    end

    end
    while true do
    STAGE1()
    RESET()
    Subtract()
    STAGE3()
    RESET()
    Subtract()
    STAGE2()
    RESET()
    Subtract()
    STAGE4()
    RESET()
    Subtract()
    end

    • @MisMatch1234
      @MisMatch1234 11 дней назад

      I am actually so proud of myself for this even though it isn't much (:

    • @Filaaaa
      @Filaaaa 8 дней назад

      @MisMatch1234 it is really cool! dont give up, the only thing i dont understand is why stage 4 is before stage 1, but other than that a great code!

    • @Filaaaa
      @Filaaaa 8 дней назад

      @MisMatch1234 i really liked your minigame alot and i made something simillar but stages are random
      local part1 = script.Parent.Part1
      local part2 = script.Parent.Part2
      local part3 = script.Parent.Part3
      local part4 = script.Parent.Part4
      local timer = 3
      local function reset()
      part1.BrickColor = BrickColor.Black()
      part2.BrickColor = BrickColor.Black()
      part3.BrickColor = BrickColor.Black()
      part4.BrickColor = BrickColor.Black()
      part1.Transparency = 0
      part2.Transparency = 0
      part3.Transparency = 0
      part4.Transparency = 0
      wait(timer)
      end
      local function stages()
      local rng = math.random(1,4)
      if rng == 1 then
      part1.BrickColor = BrickColor.Red()
      part2.BrickColor = BrickColor.Red()
      part3.BrickColor = BrickColor.Red()
      wait(timer)
      part1.Transparency = 1
      part2.Transparency = 1
      part3.Transparency = 1

      wait(timer)
      elseif rng == 2 then
      part1.BrickColor = BrickColor.Red()
      part2.BrickColor = BrickColor.Red()
      part4.BrickColor = BrickColor.Red()
      wait(timer)
      part1.Transparency = 1
      part2.Transparency = 1
      part4.Transparency = 1
      wait(timer)
      elseif rng == 3 then
      part2.BrickColor = BrickColor.Red()
      part3.BrickColor = BrickColor.Red()
      part4.BrickColor = BrickColor.Red()
      wait(timer)
      part2.Transparency = 1
      part3.Transparency = 1
      part4.Transparency = 1
      wait(timer)
      elseif rng == 4 then
      part1.BrickColor = BrickColor.Red()
      part3.BrickColor = BrickColor.Red()
      part4.BrickColor = BrickColor.Red()
      wait(timer)
      part1.Transparency = 1
      part3.Transparency = 1
      part4.Transparency = 1
      wait(timer)
      end
      end
      local function subtract()
      if timer > 0.5 then
      timer = timer - 0.5
      else
      timer = 0.5
      end
      end
      while true do
      stages()
      reset()
      subtract()
      end

    • @MisMatch1234
      @MisMatch1234 8 дней назад

      @ Ty! A I am almost to the random tutorial and I was planning on making it random once I got there! Glad you liked it!

    • @MisMatch1234
      @MisMatch1234 8 дней назад

      @Filaaaa it just changes the order a bit

  • @scratchystuff
    @scratchystuff Месяц назад

    congrats on almost 30k subs!!

  • @slaveigaming
    @slaveigaming 20 дней назад +1

    what does the 3 number on the right do in the for while loop

    • @ISeeThatManLoL
      @ISeeThatManLoL 20 дней назад

      i will watch the video and hopfully i can awnser you

  • @ArdaPOLAT-n3x
    @ArdaPOLAT-n3x 10 дней назад +1

    Man, this guy's videos are getting fewer and fewer views. Between his first video and this one, many people have already left (there are still those who are determined and patient)

  • @MrChicken-db1ms
    @MrChicken-db1ms 3 месяца назад +1

    finally a actually good tutorial series

  • @T4MIL0RE_09
    @T4MIL0RE_09 2 месяца назад +2

    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
      @InidiumIsCool 2 месяца назад

      U don't need more than 1 I dunno why he did that

  • @materwelone6026
    @materwelone6026 5 месяцев назад +10

    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

    • @eyadosama4381
      @eyadosama4381 2 месяца назад +5

      calm down we still dont know these things😐

    • @EnorMooseChannel
      @EnorMooseChannel 2 месяца назад +1

      @@eyadosama4381 Vector is position, Anchored means wether the object is unmovable or movable, or let just say anchored. Instance means creating something

  • @charlieroberts1352
    @charlieroberts1352 Месяц назад

    Also thankyou so much for making this tutorials its so helpfull

  • @Cannonplaylol
    @Cannonplaylol 4 месяца назад +1

    making the baseplate change colors is really fun

  • @TheMoonlighty
    @TheMoonlighty 4 месяца назад

    Thanks! i rlly love what i have done just now!!!!

  • @ElTonio2023
    @ElTonio2023 3 месяца назад +19

    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!")

    • @ElTonio2023
      @ElTonio2023 3 месяца назад +1

      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
      @EnorMooseChannel 2 месяца назад

      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
      @domakrsnah1612 Месяц назад

      you don't need to write "task" just write wait()

    • @EnorMooseChannel
      @EnorMooseChannel Месяц назад +1

      @@domakrsnah1612 wait is actually deprecated, but I only discover it now

    • @EnorMooseChannel
      @EnorMooseChannel Месяц назад

      @@domakrsnah1612 either ways they're the same I guess

  • @oxerful5426
    @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
      @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

  • @diwalkersp2990
    @diwalkersp2990 4 месяца назад +1

    Just asking why would you need all of the different types if they all do the same thing?

    • @nzm_f6425
      @nzm_f6425 3 месяца назад +3

      Coding is a logical computer language. Who knows what problem may occur, more option is better for that case in my opinion

  • @aapple7993
    @aapple7993 5 месяцев назад +1

    -- 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

  • @TridentTrist
    @TridentTrist 12 дней назад

    Thank you! What I learned today was that I shouldn't have put 9.99e+9999 in the repeat loop in an attempt to replicate a forever loop like in scratch!

  • @PolygonalCharlz4632
    @PolygonalCharlz4632 12 дней назад

    My fav episode so far. I was so surprised when he said, "wait statement". Like my face was literally 😯

  • @Ulysses.1
    @Ulysses.1 6 месяцев назад +2

    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

  • @nightcatyoutube
    @nightcatyoutube 2 месяца назад +1

    hey brawldev can you explain a little more about the last number on the for myCounter = 1, 5, 1

    • @CalebAdeyemo
      @CalebAdeyemo 2 месяца назад

      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!

  • @aleksandarvukicevicpk
    @aleksandarvukicevicpk 17 дней назад

    Quick explanation: I made a lava texture object which i called "MagmaPart", which i used to test my loops.
    local cube = game.Workspace.MagmaPart
    local counter = 1
    while counter < 2 do
    cube.BrickColor = BrickColor.new("Really red")
    task.wait(1)
    for counter2 = 1, 10, 2 do
    cube.Material = "Marble"
    task.wait(1)
    cube.Material = "Basalt"
    task.wait(1)
    end
    cube.BrickColor = BrickColor.new("Toothpaste")
    wait(1)
    end

  • @Anonymous_still
    @Anonymous_still 6 месяцев назад +1

    commenting just to boost your channel

  • @esnowbw
    @esnowbw 22 дня назад

    just a small tip i learnt from java, instead of doing myWhileCounter = myWhileCounter + 1, you can actually just do myWhileCounter += 1, which means the exact same thing :)

  • @goodnoob857
    @goodnoob857 5 месяцев назад +1

    I have skills with python, but I like to create games in roblox studio so I will learn lua from you thanks

  • @eeScore
    @eeScore 2 месяца назад +1

    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

  • @jasondiop1704
    @jasondiop1704 3 месяца назад +5

    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
      @Timmyroblox 2 месяца назад

      Thank you it’s very clear now because I’m not very good at English so yeah xdd

  • @market4457
    @market4457 4 месяца назад +2

    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

  • @diamondsminer1239
    @diamondsminer1239 23 дня назад

    7:36 If u said that one second earlier I wouldn't have crashed LOL

  • @atotallylazyperson
    @atotallylazyperson 4 месяца назад

    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

  • @oberonpanopticon
    @oberonpanopticon 5 месяцев назад +2

    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

    • @0n0rchy
      @0n0rchy 4 месяца назад

      bro really? computer science?

    • @SouradiptaPlays
      @SouradiptaPlays 4 месяца назад

      @@0n0rchy i think he means like the basic programming concepts like if statements, loops, variables, etc. :)

  • @BKLanger
    @BKLanger 5 месяцев назад +1

    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

  • @WhoLetsBludCook
    @WhoLetsBludCook Месяц назад +1

    Why does dawg explain it so well

  • @mari.87e
    @mari.87e 6 месяцев назад +3

    FIRST COMMENR AND UR VIDEOS R AMAZING KEEP POSTING DUDE!

    • @dulipa8727
      @dulipa8727 5 месяцев назад

      no one cares if you're "first"

  • @DA-hd7vt
    @DA-hd7vt 3 месяца назад +1

    protect this guy at all costs

  • @PowerfulSpeakerman
    @PowerfulSpeakerman 5 месяцев назад +1

    how do you apply this when you get to real scripting? and not just showing up on the output?

    • @pryt0n180
      @pryt0n180 5 месяцев назад

      That's the neat part, you don't.

    • @SimplyTutuco
      @SimplyTutuco 3 месяца назад

      @@pryt0n180 You do, but later

    • @SimplyTutuco
      @SimplyTutuco 3 месяца назад

      You do, but later.

  • @daniel_denamit724
    @daniel_denamit724 5 месяцев назад +1

    yooo realy cool and realy easy to understand

  • @atotallylazyperson
    @atotallylazyperson 4 месяца назад

    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

  • @Yaboy8r1
    @Yaboy8r1 6 месяцев назад

    Will you continue the advance scripting series?

    • @BrawlDevRBLX
      @BrawlDevRBLX  6 месяцев назад

      Yes

    • @Yaboy8r1
      @Yaboy8r1 6 месяцев назад

      @@BrawlDevRBLX Ty, I am at lost of a clear direction now that I finished all your advanced tutorials.

    • @osakadev
      @osakadev 6 месяцев назад

      @@Yaboy8r1 He will continue the advanced tutorials once he finish these beginner videos

  • @jordyyn
    @jordyyn 6 месяцев назад

    one of the best scripting tutorials out there, thanks

  • @Patgad-M815
    @Patgad-M815 2 месяца назад

    just a question but what does print do in games? Sorry if this question was already asked or just straight up stupid :)

    • @Tobi_Akuma
      @Tobi_Akuma 12 дней назад

      In Lua programming, print is a built-in function that is used to output data to the console or standard output. It allows developers to display values, messages, or other types of information during the execution of a program.

  • @AbdulMezooghi
    @AbdulMezooghi 6 месяцев назад

    Your amazing at teaching

  • @MorsaTactica
    @MorsaTactica 5 месяцев назад

    Before starting the tutorial i only known how to print, but now i am a true proffesional, Thanks!

  • @Tifferthegreat
    @Tifferthegreat 5 месяцев назад +1

    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

  • @Donpa07
    @Donpa07 6 месяцев назад

    is there any about I,V tutors? if not i cant wait to see it

  • @FakeJohnRobloxLol
    @FakeJohnRobloxLol 9 дней назад

    with what i learned i did this countdown (also i did the loop mechanic so is changable ez)
    for countdown = 3, 3, 3 do
    print("3")
    wait(1)
    print("2")
    wait(1)
    print("1")
    wait(1)
    do
    print("go")
    end
    end
    (I didnt include while since i cant think of a scenario with it)

  • @InspiredByME-x1t
    @InspiredByME-x1t 2 месяца назад

    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

  • @Joeyz2
    @Joeyz2 13 дней назад +1

    local baseplate = game.Workspace.Baseplate
    for myLoop = 1, 10, 1 do
    baseplate.BrickColor = BrickColor.new("Wheat")
    task.wait(0.5)
    baseplate.BrickColor = BrickColor.new("Teal")
    task.wait(0.5)
    baseplate.BrickColor = BrickColor.new("Lime green")
    task.wait(0.5)
    baseplate.BrickColor = BrickColor.new("Navy blue")
    task.wait(0.5)
    baseplate.BrickColor = BrickColor.new("Toothpaste")
    end

  • @lychezr
    @lychezr 8 дней назад

    6:48 when i did this, i wanted to test it and i didnt listen to the warning, but when i realized the number cant change my roblox studio crashed becuase it made infinite loop
    woopsies

  • @Darkness_1-y1w
    @Darkness_1-y1w 5 месяцев назад +2

    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

    • @bobuxcartel4051
      @bobuxcartel4051 4 месяца назад

      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

    • @GTEditsOfficial
      @GTEditsOfficial 4 месяца назад

      how do you do this I don’t remember anything from the past episodes

  • @mr.crazycatlover1312
    @mr.crazycatlover1312 Месяц назад

    How would you make a loop that continues until a variable is true of false for example

  • @3DDUDESDUO
    @3DDUDESDUO Месяц назад

    BrawlDev the teacher we never asked for but need this whole time you have earned a sub and here's my learning objective.
    local sphere = game.Workspace.RGB
    for myCounter = 1, 10, 1 do
    sphere.BrickColor = BrickColor.new("Really red")
    print("woah im red")
    wait(2)
    sphere.BrickColor = BrickColor.new("Really blue")
    print("woah now im blue")
    wait(2)
    sphere.BrickColor = BrickColor.new("Lime green")
    print("wow grass")
    wait(2)
    sphere.Material = "LeafyGrass"
    print("YAY IM GRASS NOW")
    wait(2)
    sphere.Material = "Plastic"
    sphere.BrickColor = BrickColor.new("Pink")
    print("IM A PREPPY PRINCESS NOW")
    end

  • @mr.arnav_offcial
    @mr.arnav_offcial 3 месяца назад

    this could help me in making a day night cycle thank you🙂

  • @hagamer3214
    @hagamer3214 24 дня назад

    this is the hardest one yet but living through it i dont understand it fully

  • @salavor1
    @salavor1 Месяц назад

    while whileloop

  • @الخلبوصة
    @الخلبوصة 6 месяцев назад

    Random question.
    If I re-uploaded your channel profile picture to Roblox under my account, will you file a DMCA takedown?

  • @ItsBloxyDude
    @ItsBloxyDude Месяц назад

    I have question, what is the use of task?
    When I say wait(insert number here) it works?

  • @thetipher
    @thetipher Месяц назад +1

    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

  • @BHG594
    @BHG594 Месяц назад +1

    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

  • @liutenant-blob_pond
    @liutenant-blob_pond 3 месяца назад

    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

  • @Gt5btttfrertsssbdtbger
    @Gt5btttfrertsssbdtbger 19 дней назад +1

    here is my code:
    local baseplate = game.Workspace.Baseplate
    task.wait(3)
    for myCounter1 = 1, 9999999999999, 1 do
    baseplate.BrickColor = BrickColor.new("Really red")
    task.wait(0.1)
    baseplate.BrickColor = BrickColor.new("Toothpaste")
    task.wait(0.1)
    baseplate.BrickColor = BrickColor.new("Lime green")
    task.wait(0.1)
    baseplate.BrickColor = BrickColor.new("New Yeller")
    task.wait(0.1)
    end

  • @AdamAdam-kx4fs
    @AdamAdam-kx4fs 20 дней назад

    W vid, learned a lot today. Heres what I made:
    local baseplate = game.Workspace.Baseplate
    for myCounter = 1, 10, 1 do
    baseplate.BrickColor = BrickColor.new("Lime green")
    baseplate.Transparency = 0.8
    task.wait(1)
    baseplate.BrickColor = BrickColor.new("Toothpaste")
    baseplate.Transparency = 0
    task.wait(1)

    for myCounter2 = 1, 3, 1 do
    baseplate.Material = "Pebble"
    task.wait(1)
    baseplate.Material = "Limestone"
    end
    end

  • @winntt4973
    @winntt4973 2 месяца назад

    What if i want to use 2 infinite loops at the same time? Will i need to create 2 different scripts?

  • @IngeFersTe
    @IngeFersTe Месяц назад

    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

  • @mokieaaa
    @mokieaaa 5 месяцев назад

    have you gained 500 subscribers in one day? yesterday I feel like you were at 9.6k!

  • @Hallow73
    @Hallow73 6 месяцев назад

    How many videos will be in this playlist?

  • @thetruebigfloppa
    @thetruebigfloppa Месяц назад

    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

  • @ShinyLittenvr
    @ShinyLittenvr Месяц назад

    I love crashing python idle shell using wire loops ( while True:
    print(“hi”)

  • @MrPicklekvGygA
    @MrPicklekvGygA 2 месяца назад

    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

  • @korudo855
    @korudo855 4 месяца назад

    can anyone explain to me a bit more on what the 3rd number does? 4:19

    • @Yennifelipe
      @Yennifelipe 3 месяца назад

      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

  • @SimplyTutuco
    @SimplyTutuco 3 месяца назад

    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

  • @MrTazx
    @MrTazx Месяц назад

    8:04 I already did this I guess I predicted the future lol

  • @aVeryFunGuy0
    @aVeryFunGuy0 3 дня назад

    7:36 POV: me pressing play right before that

  • @QanGaming69420
    @QanGaming69420 2 месяца назад

    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

  • @genesis.catluvr
    @genesis.catluvr 12 дней назад

    local baseplate = game.Workspace.Baseplate
    if 2 + 2 == 4 and 3 + 1 == 4 then
    print("working")
    for myLoop = 1, 10, 1 do
    baseplate.Transparency = 0.1
    task.wait(.5)
    baseplate.Transparency = 0.5
    task.wait(.5)
    baseplate.Transparency = 1
    task.wait(1)
    end

    else print("error")
    end

  • @TheLivingSentientBox
    @TheLivingSentientBox 18 дней назад

    Got back to this tutorial after a bit, here's what I wrote:
    for myCounter = 1, 5, 1 do
    print("A")
    for myCounter2 = 1, 5, 1 do
    print("B")
    end
    end
    local myWhileCounter = 1
    while myWhileCounter

  • @YCre4tor
    @YCre4tor Месяц назад

    7:30, yes I noticed that... about 30 seconds ago.

  • @Desyeditz
    @Desyeditz 2 месяца назад

    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

  • @psremoteacc
    @psremoteacc 2 месяца назад

    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()

  • @SLAYBOT_9000
    @SLAYBOT_9000 5 месяцев назад +1

    these numbers r hurting my head WAAAAAAAAAAAAAAAAAAAAAAAAAAAA

    • @SLAYBOT_9000
      @SLAYBOT_9000 5 месяцев назад +2

      sniff.... i will soldier through......

    • @SLAYBOT_9000
      @SLAYBOT_9000 5 месяцев назад +1

      im going outside and lighting myself on fire

  • @ElementalClips11
    @ElementalClips11 Месяц назад

    if 3 + 3

  • @Qualet-h7m
    @Qualet-h7m Месяц назад

    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

  • @FakeJohnRobloxLol
    @FakeJohnRobloxLol 9 дней назад

    Brawldev the waiting function doesnt need the "task." Since it still works

  • @randomdudeguy6864
    @randomdudeguy6864 6 месяцев назад

    Could you maybe do a video on particles and effects? Stuff like auras, beams, etc.

  • @DaStranded64
    @DaStranded64 Месяц назад

    isn't wait(1) the same thing as task.wait(1)

  • @FunStuffOTW
    @FunStuffOTW Месяц назад

    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

  • @jreak
    @jreak 19 дней назад

    Ah, loops my nemesis.