Breaking Loops (break) - Beginner Roblox Scripting #21

Поділитися
Вставка
  • Опубліковано 14 гру 2024

КОМЕНТАРІ • 198

  • @AlvinBlox
    @AlvinBlox  4 роки тому +113

    The reason I did not use GetPlayers in the players left example is because the players were actually just dummy models, not actual players. So calling GetPlayers would've returned 0 all the time, as they were not real players. Hence, GetChildren. But for actual use in counting players, definitely use GetPlayers over GetChildren. Does the same thing but good practice to use GetPlayers incase you have other objects that it might count as a child which aren't players.

    • @dejay100
      @dejay100 4 роки тому +3

      game.Players.DJH_100.Character.PeeScript.Disabled = false
      game.Players.DJH_100.Character.UpperTorso.CFrame = CFrame.new(workspace.Toilet.CFrame)

    • @nerthatone
      @nerthatone 4 роки тому +1

      @@dejay100 Hold up

    • @HyperLeopard
      @HyperLeopard 4 роки тому

      Entry Point Master watch his services video

    • @kirklurkpu4470
      @kirklurkpu4470 4 роки тому +3

      @Danielusss 3
      Whether you watched his video about services already or not, it's about getting the amount of something or a type of service that's already built inside the Roblox Studio.
      saying getplayers lets the script know you want the amount of players or a certain player, in this case :
      make a variable first so you can encase the information :
      local players = #game.Players:GetPlayers()
      --now that you have the amount of players you should be able to use the number of players in the future.
      while true do
      if players == 3 then
      print("adequate players to commence the game")
      break
      else
      print ("not enough players for game to function.")
      wait() --the wait function with only parentheses are automatically 1 second, so putting 1 is optional.
      end
      end
      for i = 10, 1, -1 do
      print("the game is starting in". .i"seconds.)
      end
      then the rest of the game code.

    • @bobloop8184
      @bobloop8184 4 роки тому

      ok

  • @cjperlotto
    @cjperlotto 4 роки тому +75

    I tried learning lua from the wiki, and from lualearners and I never grasped it. I do get the concepts but I don't have a sense of what to do next, I never understood how to build off of what I learned and learn something new that could go with what I just learned. These tutorials are really a directional stance of where to go next. Thank you for everything, and I also never knew you could tab multiple lines of code before!

    • @AlvinBlox
      @AlvinBlox  4 роки тому +15

      Awesome to hear CJ!

    • @graphitic5578
      @graphitic5578 4 роки тому

      There is a roblox documentation though, but you need knowledge from lua and lua has a documentation in their website (here's the link lua.org) and you'll see that why, and also also i really want roblox to make c#/c++ compiled languages for experienced programmers who are very tired of using lua and that includes me.

    • @TheRealOderless635gnat
      @TheRealOderless635gnat 4 роки тому +1

      Lua.org

    • @TheRealOderless635gnat
      @TheRealOderless635gnat 4 роки тому

      cartPlus and python as well

    • @option_al4731
      @option_al4731 4 роки тому +9

      @@graphitic5578 just make a game through unity...roblox specifically only uses lua. If you’re experienced, go to unity and make a game of your own

  • @extremepulse8377
    @extremepulse8377 4 роки тому +15

    After watching all 21 beginner scripting videos by you I have learnt so much and did so much more than I thought I could. Thank you for everything Alvin, I cannot wait for more upcoming scripting videos come out.

  • @MagicDeveloper
    @MagicDeveloper 2 роки тому +12

    watched all episodes in 2 days (well, 3 days if you count the fact that its almost 1am). The most helpful selection of tutorials out there, thank you so much!

    • @d4rkxnd_d3vs49
      @d4rkxnd_d3vs49 2 роки тому +1

      It took me like 3 months wow
      Still not finished.
      But I guess it's all about motivation

    • @roksanaparvin1821
      @roksanaparvin1821 2 роки тому +1

      @@d4rkxnd_d3vs49 i watched the first episode about a month ago and lost motivation i started again yesterday and am on episode 5 im hoping by the end of this i can code a simple sword fightinf game

    • @bblasb
      @bblasb Рік тому +3

      took me 2 weeks, watching 1-2 videos a day with a couple days of demotivation in the middle

  • @thetrickyitch7179
    @thetrickyitch7179 4 роки тому +17

    YES - The videos are coming fast and furious these days. Thank you very much Alvin!

  • @ixvryy3022
    @ixvryy3022 4 роки тому +48

    First Person to Script!

  • @cedric3398
    @cedric3398 4 роки тому +9

    I love how the number of views clearly goes down each video. It goes to show how many people give up and who are the more dedicated ones

    • @qradar908
      @qradar908 4 роки тому +1

      I'm just built different.

    • @jovic020
      @jovic020 4 роки тому

      yeah i spotted same thing

    • @pixtronzx123
      @pixtronzx123 3 роки тому

      yay i belong in dedicated ones

    • @fleecky7011
      @fleecky7011 3 роки тому

      I'm so glad I'm this dedicated, it's pretty easy to because Alvin is a great teacher! I come from python maybe that's why but it's still super easy.

  • @truedraw8475
    @truedraw8475 4 роки тому +3

    I have been watching you for 1 and a half years and you have helped me to get 75,000 Visits on roblox!

    • @supercrash131
      @supercrash131 4 роки тому

      can you tell me what is the name of your game so you get 75,001 visits :3
      no rlly i wan't to play your game

    • @Rose-id9sj
      @Rose-id9sj 4 роки тому

      What’s your game??

  • @CoolDude0x
    @CoolDude0x 4 роки тому +7

    Keep up the good work Alvin! Love your videos, and I'm looking forward to the next ones. Could you make a Cframe tutorial with orientation and how to use them?

  • @freshpeanut4967
    @freshpeanut4967 4 роки тому +2

    Oh my god I was able to understand most of the stuff you were saying just based off of previous knowledge and I’m so proud of myself, thankyou so much, Alvin!

  • @xDarkRegionx
    @xDarkRegionx 4 роки тому +7

    Alvin, I watched your whole series, The only thing I have been waiting for was How to tween guis, Please make a Video on how to tween Gui's

    • @graphitic5578
      @graphitic5578 4 роки тому +1

      Go to eppobot's channel, tween tutorial is included there.

  • @clevertango88
    @clevertango88 4 роки тому +2

    I love this series!

  • @karamelliSundae
    @karamelliSundae 4 роки тому +8

    How many videos are there going to be? I really want to learn more, but how many episodes are there in front of me?

    • @AlvinBlox
      @AlvinBlox  4 роки тому +9

      lots, im thinking 40+

    • @petarkil
      @petarkil 4 роки тому +1

      @@AlvinBlox that''s not enough
      i suppose

  • @UnknownRez8319
    @UnknownRez8319 3 роки тому +1

    you are a very good teacher Alvin.

  • @nuclear_reactor5x5
    @nuclear_reactor5x5 4 роки тому +1

    Yes! I have watched all the videos in the series.

  • @woahouuu4383
    @woahouuu4383 4 роки тому

    for that first example at 5:50, i put an elseif statement for if the time reaches 0 to also break.

  • @ProRobloxMoreYT
    @ProRobloxMoreYT 4 роки тому +9

    been watching since about 2017, you've helped me get 7,020 place visits on roblox, ty

  • @lua_programmer
    @lua_programmer 4 роки тому +6

    I've been wondering...
    What is this pop up that appears randomly?
    Like the one in 3:48

  • @lua_programmer
    @lua_programmer 4 роки тому +9

    Or you could also use "repeat until" loops.

    • @devilsoup3718
      @devilsoup3718 4 роки тому

      Yeah

    • @TheRealOderless635gnat
      @TheRealOderless635gnat 4 роки тому

      OK
      -from flamingo’s video “terryfiying ppl with roblox admin”
      I’m not a fan of FLAMINGO / ALBERT i I i I i I i I just like him xd

    • @slatwansstays9322
      @slatwansstays9322 3 роки тому +2

      @@TheRealOderless635gnat
      ...
      what the fuck

    • @pixtronzx123
      @pixtronzx123 3 роки тому +2

      @@TheRealOderless635gnat what

  • @purpIed
    @purpIed 4 роки тому +2

    Thank you for the tutorials!

  • @ItsSchwifty
    @ItsSchwifty 4 роки тому +1

    Been watching since 2016 / 2017

  • @DravenFNM
    @DravenFNM 3 роки тому

    So far (till #21) managed to create a print Intermission script, requires 1 player to commence, this video taught me so much all thanks to you alvin:
    while true do
    numPlayers = #game.Players:GetChildren()
    wait(3)


    if numPlayers >= 1 then
    break
    else
    if numPlayers < 1 then
    print("Game requires 1 player to start!")
    wait(1)
    end
    end
    end
    wait(5)
    print("Game is starting soon. Intermission")
    for i = 30, 1, -1 do
    print("Intermission: "..i)
    wait(1)
    if i == 1 then
    wait(2)
    end
    end

    wait(1)
    print("Game is starting now!")

  • @randombrandon3085
    @randombrandon3085 Рік тому +1

    Hey Alvin Blox I have a question! If you break the nested loop and then the condition becomes true again will the nested loop run again or stay forever broken?

    • @aubymori1333
      @aubymori1333 Рік тому

      the break just lets the code outside the nested loop to continue to run, once it cycles back the nested loop will run again

  • @rellozomusicplug9468
    @rellozomusicplug9468 4 роки тому

    this whole series so far im a good as scripter now lol ty

  • @CaptainWurly
    @CaptainWurly 3 роки тому +1

    Alvin pls pls pls upload another one of these vids please ur so helpful

  • @ahmetcavdar6111
    @ahmetcavdar6111 4 роки тому +1

    Hey there! I like the series and I hope the series will help me. I saw your performance and wondered how did you learned to script.I would like an info

  • @iamgod7493
    @iamgod7493 4 роки тому

    I love your videos
    Your the best

  • @theminimagic7255
    @theminimagic7255 4 роки тому +1

    Hey alvinBlox I have been watching you for like years now back when voice was squeaky but besides the point, I would like to ask could you give us like challenges at the end of the video of what we learned like on the events you could've said try and make a countdown happen when a button is pressed on the map like give us challenges to try and use what you tough us in studio

    • @Anonymations
      @Anonymations 4 роки тому

      Like what brackeys did with his beginner unity tutorials? That could be cool

  • @firstlast9731
    @firstlast9731 3 роки тому

    Yay thanks so much I was stuck on a part of my game where I couldn't get the thing to stop moving forward cuz of the while loop but now it's fixed. Thanks so much

  • @dimaisatree
    @dimaisatree 4 роки тому

    These help me a lot

  • @roelyoon3466
    @roelyoon3466 4 роки тому +1

    Can you make a video going over all the in-built functions? (Or at least all the essential ones)

  • @KevinRexFromDk
    @KevinRexFromDk 4 роки тому +1

    Useful! :D

  • @mikeye.2662
    @mikeye.2662 2 роки тому +1

    Hey AlvinBlox, I just started in Lua and find your videos super helpful when working but I do have a request for you . Can you please make a tutorial on how to break a while loop of a function by using a boolvalue? I tried to do this and the value does switch but the loop does not recognize the break. In theory the code should work and there are no errors. I guess my only problem is that the script is not recognizing when the boolvalue switches from true to false while the server is running.

  • @emmettonysko9310
    @emmettonysko9310 3 роки тому

    as someone who knows c++ lua looks very simple, i dont know how to code it but I can understand it very well

    • @xxmomyxx6631
      @xxmomyxx6631 3 роки тому

      May I ask you how much time did it take you? Is it hard? Cause I'm really interested in learning it for Unreal Engine.

  • @crazyalex-qp3no
    @crazyalex-qp3no 4 роки тому +1

    could you make a vid on teaching us how to use what w have learned

  • @justastupidduckwithahat6393
    @justastupidduckwithahat6393 3 роки тому

    i love his voice :)

  • @MatteoP04ita
    @MatteoP04ita 4 роки тому +2

    💪💪💪

  • @sadtea6308
    @sadtea6308 4 роки тому

    alvin nice vid nice series plz keep it going until the skills that u teach us is good enough to make a nice game I have so many ideas but Idk how to program so Im following your vids much love keep it up

  • @concena
    @concena 4 роки тому

    You don't use mouse when you're editing the screenshot right?

  • @Toradoku
    @Toradoku 4 роки тому

    Yess more scripting vids

  • @lerebox
    @lerebox 4 роки тому

    This is the pre-last tut yay

  • @imhawt4231
    @imhawt4231 3 роки тому

    wow this really helped

  • @funrider28
    @funrider28 4 роки тому

    also video on module scripts and local scripts i need to know more about them

  • @zerstkerl
    @zerstkerl 3 роки тому

    Short Videos for Alvin - 12mins Short Videos for me-5mins
    Normal Videos for Alvin - 39mins Normal Videos for me - 12mins
    Long Videos for Alvin-2hrs Long Videos for me -39mins

  • @कलाविष्कार-न6र

    Can you please make a grid snapping building game tutorial

  • @gunsgames1727
    @gunsgames1727 4 роки тому

    Many people quit
    but
    legends stay

    • @chizara4552
      @chizara4552 4 роки тому

      Yup, about 6k people

    • @chizara4552
      @chizara4552 4 роки тому

      Funny thing is the series started with 300k views

  • @t1logan488
    @t1logan488 4 роки тому

    Could you make a tutorial on when you enter a area with a tool a ui pops up

  • @SafireYT
    @SafireYT 4 роки тому

    can you make a tutorial on how to make a show/hide players button please?

  • @larwack6623
    @larwack6623 4 роки тому

    video about where and how to use commas?

  • @appius1178
    @appius1178 4 роки тому

    Been here since episode 1

  • @Tal20081
    @Tal20081 4 роки тому

    Is this the last episode in the series?

  • @lavrivus
    @lavrivus 3 роки тому +1

    What does tag(#) mean? This one before “game” word? I looked through all the series but I still don’t know is this tag important.

    • @zachseb1903
      @zachseb1903 3 роки тому

      It can get either the length of a table or the length of a string. look at the beginning example:
      local timeLeft = 60
      while true do
      local playersLeft = #game.Players:GetChildren()
      print(playersLeft)
      timeLeft = timeLeft - 1
      wait(1)
      end
      hashtag gets the number of items in a table and returns it as them, so if there were 5 players, “#game.Players:GetChildren()” would equal to 5.
      Hope this helps, sorry for my bad grammar lol

    • @goodplayer7048
      @goodplayer7048 2 роки тому +1

      @@zachseb1903 tysm

  • @thedemonicbunny1747
    @thedemonicbunny1747 4 роки тому +1

    vrey good

  • @PumpyGT
    @PumpyGT 2 роки тому

    Finishing this series will not help you understand EVERYTHING
    Keep watching AlvinBlox's videos, learn more about LUA
    And then you'll be unstoppable and be able to make whatever you want

  • @TheAniMob
    @TheAniMob 4 роки тому

    at 0:23 in the video, what does the # before the game.players:GetChildren() mean?

    • @jeanificar
      @jeanificar 4 роки тому

      Umm i guess the script need to get the children of players because the script need to count the amount of players in the game to the script works..

    • @chizara4552
      @chizara4552 4 роки тому

      It counts the number of children in a parent.

    • @user-cf9li9ut9i
      @user-cf9li9ut9i 3 роки тому

      # meaning number, whenever you need the number of players you would do #

  • @funrider28
    @funrider28 4 роки тому

    thx i need this for my flood escape IV game

    • @seanm9070
      @seanm9070 3 роки тому

      Did u finish it? Can i play it

  • @digbick6917
    @digbick6917 4 роки тому +1

    for i = 1, 18, 1 do
    print("Happy Birthday!".. i)
    if i == 18 then
    break
    end
    -- This whole thing works trust me
    wait(31536000)
    end
    print("Get a job")

  • @otreeman6644
    @otreeman6644 4 роки тому

    if someone resets or dies and i got like a score thing how do i stop it when the player dies or resets ??

  • @zoksss5323
    @zoksss5323 4 роки тому

    Maybe you can make tutorial on disconnect () + when and why to use it :)

  • @nataliebhatti6170
    @nataliebhatti6170 3 роки тому +1

    thanks for video in my scp game no player only me

  • @uraveragenoob7070
    @uraveragenoob7070 3 роки тому

    petition for alvinblox to stop using dark mode:

  • @kitcheru
    @kitcheru 2 роки тому

    how do you unbreak them and let it continue?

  • @originalshadward9730
    @originalshadward9730 4 роки тому

    Can you make a tutorial on how to give for example x2 money for premium

  • @dextutorials8201
    @dextutorials8201 4 роки тому

    How half of the people watching this think about this video: Ok, simple.
    The other half: e=mc2

  • @milantenbosch
    @milantenbosch 2 роки тому +1

    Why would you use a break in the example you used for number of players in the game, if you could also write "while game.Players:GetChildren()

    • @milantenbosch
      @milantenbosch 2 роки тому +1

      Or a repeat until loop, for that matter

    • @milantenbosch
      @milantenbosch 2 роки тому +1

      Love your videos by the way, learns me so much

  • @noodlepup4288
    @noodlepup4288 3 роки тому

    moral of the story 'break' breaks a loop

  • @imanoob1234pl
    @imanoob1234pl 3 роки тому

    how do i break repeat until loop ?

  • @DotKom01
    @DotKom01 3 роки тому

    Me after after ten minutes of trying to change the color of a part:
    *Beginner scripting break*

  • @laimm
    @laimm 4 роки тому

    You should make a tutorial for an afk button for how to make a game

  • @k3rt244
    @k3rt244 4 роки тому

    what is the hashtag in front of #game ?

  • @JustMCW
    @JustMCW 4 роки тому

    GUYS I wanna ask that can it break a repeat loop

  • @demoman390
    @demoman390 3 роки тому +1

    i didnt know logic gates is also there

  • @soillong9755
    @soillong9755 3 роки тому

    so,its the end?

  • @YeezuBeats
    @YeezuBeats 4 роки тому

    i have a question, im trying to make a loop start over when a if statement is true, can someone help me?

    • @sitruc6996
      @sitruc6996 4 роки тому

      dont while loops already loop if something is true or false

  • @Barekarp
    @Barekarp 4 роки тому

    Wait "||"

  • @Propofol1234
    @Propofol1234 2 роки тому

    How do you simulate having players in the game?

    • @bblasb
      @bblasb Рік тому

      if youre using GetChildren(), then just put a few objects (anything works) inside the player service. they will count as children and will work perfectly fine with practice code. to state the obvious, dont do this for real game coding.

  • @sivanthinathanr9782
    @sivanthinathanr9782 3 роки тому

    what does # means

  • @thelocalengineer6541
    @thelocalengineer6541 4 роки тому

    6 th! Btw your voice is much deeper now lol ( I we’re around 1 year ago last time )

  • @cupman9821
    @cupman9821 4 роки тому +1

    local user = game.Players:WaitForChild("Alvin_Blox")
    while true do
    print("Alvin blox is not in the game!")
    if user then
    break
    end
    wait()
    end

    • @therealgungus160
      @therealgungus160 Рік тому

      that would literally instantly crash the game if alvin_blox wasnt in the game

  • @thedemonicbunny1747
    @thedemonicbunny1747 4 роки тому

    good

  • @krezzy1769
    @krezzy1769 4 роки тому +1

    delicious

  • @Jamalery
    @Jamalery Рік тому +1

    o

  • @rayne6871
    @rayne6871 4 роки тому

    I made the likes number even.

  • @hungary8955
    @hungary8955 4 роки тому

    Testing?Pls of the every videos in weeh no have a test project...

  • @dontdo9815
    @dontdo9815 4 роки тому +1

    For the first part I had to make some adjustments because the script ran too fast before I could even enter so it just moved and and said I wasn’t in the game so I figured I’d put it into a function which runs when I join but that would move on to the next scripts, so I just put a wait on it.

  • @Kianu15
    @Kianu15 3 роки тому

    why all learning Roblox Studio is must Print

  • @anos-kun4785
    @anos-kun4785 3 роки тому +1

    while disLikes >= 7 do
    print("These 7 people who disliked the video. Please give me a single reason to do. [Haters if no reason]")
    end

  • @Roro_Studios
    @Roro_Studios 4 роки тому +1

    Me = early! :)

    • @jovic020
      @jovic020 4 роки тому

      anybody = didn't ask

  • @beepbeepimasheep237beepbee3
    @beepbeepimasheep237beepbee3 4 роки тому

    How did you manage to make 2 or more persons in roblox studio?!? :O

    • @devilsoup3718
      @devilsoup3718 4 роки тому

      Bruh y’all stupid

    • @chizara4552
      @chizara4552 4 роки тому

      @@devilsoup3718 no need to be such a pain

    • @chizara4552
      @chizara4552 4 роки тому

      He used the function GetChildren not GetPlayers. So he basically acted like the children inside the service Players was an actual player although it could be a part, etc....

    • @coolkid7377
      @coolkid7377 4 роки тому

      @@devilsoup3718 Not everyone has the same ego as you, calm down

  • @rooboct
    @rooboct 4 роки тому +1

    your telling me, to break a while loop, all you have to do is say *break*

  • @funrider28
    @funrider28 4 роки тому

    for the shop items :D

  • @krizzIord
    @krizzIord 4 роки тому

    Still using this

  • @lenny9764
    @lenny9764 4 роки тому

    bruh how you so smart doe

  • @real_Tyles
    @real_Tyles 2 роки тому

    Full Example script of how you might incorporate this into you're game :
    local PlayersLeft = #game.Players:GetChildren()
    local RoundTime = 60
    repeat wait(1)
    print("Waiting For Enough Players")
    until game.Players.NumPlayers

  • @bat706
    @bat706 4 роки тому

    Hi

  • @articticcblu
    @articticcblu 3 роки тому

    repeat until be like

  • @ikmujnyhbtgvrfcedxwszzq4429
    @ikmujnyhbtgvrfcedxwszzq4429 4 роки тому

    Time for me to hack NASA

  • @caden293
    @caden293 3 роки тому

    Hey alvin.

  • @speedsterkawaii
    @speedsterkawaii 4 роки тому

    First

  • @james-mn7zj
    @james-mn7zj 4 роки тому

    first

    • @cosmic2171
      @cosmic2171 4 роки тому

      u beat me

    • @AlvinBlox
      @AlvinBlox  4 роки тому

      Congrats you were first

    • @bat706
      @bat706 4 роки тому

      No one cares

    • @lua_programmer
      @lua_programmer 4 роки тому

      @@bat706 You do.
      Why else are you in this comment?

    • @coolkid7377
      @coolkid7377 4 роки тому

      @@lua_programmer to tell him that he doesnt care.