LEARN TO SCRIPT #3 - Code Blocks, If Statements, While Loops

Take your scripting knowledge to the next level! We look at code blocks, conditionals, if statements and while loops. Which we then combine to create a virtual football game simulation!
FILES ►gnome.codes/LearnToScript/
DISCORD ► / discord
TWITTER ►@gnomecodeRBLX
MUSIC
Aerosol Of My Love by Kevin MacLeod
Link: filmmusic.io/song/7013-aeroso...
License: filmmusic.io/standard-license

Пікірлер: 203

  • @kerebharrison459
    @kerebharrison4593 жыл бұрын

    By far my favorite Roblox scripting channel. Keep up the incredible work.

  • @GnomeCode

    @GnomeCode

    3 жыл бұрын

    Thanks for the good vibes!

  • @unstoppableluckq9985

    @unstoppableluckq9985

    2 жыл бұрын

    @@GnomeCode you had the key!

  • @CheesingBall

    @CheesingBall

    Жыл бұрын

    agreed

  • @apollopingu

    @apollopingu

    Жыл бұрын

    agreed

  • @herograaf5850

    @herograaf5850

    Жыл бұрын

    AGREED

  • @KnightInRed
    @KnightInRed Жыл бұрын

    This is the only channel that has thought me anything every other channel expects you to know everything

  • @uni_teto
    @uni_teto11 ай бұрын

    i've tried for over 4 years to learn how to script. this is the first time information is actually sticking to the peanut that is my brain, thank you so much for these tutorials!

  • @DoYourFrench

    @DoYourFrench

    4 ай бұрын

    Me too but just 1 day

  • @DoYourFrench

    @DoYourFrench

    4 ай бұрын

    Going on comment and found people that they learned from gnome and im here im learning faster than eishtein (okay its my spécial mind but comparing this is easier)

  • @unofficialsliceofbread6461
    @unofficialsliceofbread64612 жыл бұрын

    19:44 "We could get in trouble for that if we were in the gambling business" Nervous Chuckle

  • @Spiresnipers
    @Spiresnipers3 жыл бұрын

    This guy really helped me learn to script

  • @baileygobrr

    @baileygobrr

    3 жыл бұрын

    cant wait to see shrek be the next famous roblox developer

  • @Trazor_

    @Trazor_

    2 жыл бұрын

    @@baileygobrr that would be amazing xD

  • @KaysHero
    @KaysHero Жыл бұрын

    since i've learned from you i put a * goal = "GOOOOOAAAAALLL!!"* as a variable in the start of the script tysm for teaching us!

  • @UltraDubzYT
    @UltraDubzYT Жыл бұрын

    You are the first youtuber to ever dumb it down enough to where i understand scripting

  • @UltraDubzYT

    @UltraDubzYT

    Жыл бұрын

    also my halftime isn't working

  • @UltraDubzYT

    @UltraDubzYT

    Жыл бұрын

    im not finished with the video yet so maybe i will see a flaw in my code

  • @UltraDubzYT

    @UltraDubzYT

    Жыл бұрын

    fixed it 1 minute later lol

  • @UltraDubzYT

    @UltraDubzYT

    Жыл бұрын

    i added a part of the script anyone can use it in their game just credit me -- Ultra's Soccer Game team1 = "Ronaldo" team2 = "Messi" team1score = 0 team2score = 0 minutes = 0 while minutes if minutes == 45 then print("HALFTIME") wait(3) elseif minutes == 90 then print("FULLTIME") elseif minutes == 37 then team1score = team1score +1 elseif minutes == 73 then team2score = team2score +2 else print(team1, team1score, team2, team2score) print(minutes) wait(0.2) end minutes = minutes + 1 end if team1score > team2score then print("Messi wins the world cup! lets play football world cuuup") else print("Ronaldo wins SUIIIIIIIIII") end wait(1) print("But wait...") wait(3) print("Messi makes a comeback!") wait(2) team1score = team1score + 9999999999999 print(team1, team1score, team2, team2score) if team1score > team2score then print("Messi wins the world cup! lets play football world cuuup") else print("Ronaldo wins SUIIIIIIIIII") end

  • @crosssans9984

    @crosssans9984

    10 ай бұрын

    @@UltraDubzYT what

  • @epic3892
    @epic38922 жыл бұрын

    This helped me a lot! I just wanna say Thank you for making these scripting tutorials video.

  • @icywolf6892
    @icywolf68922 жыл бұрын

    That intro was amazing, I was having a really bad day but it instantly made my mood better

  • @DottedDee
    @DottedDee2 жыл бұрын

    Ha! the video started buffering right when he was waiting to break the studio with the While function XD I was like, "DANG that while command IS powerful"

  • @Tr0ll_Guy
    @Tr0ll_Guy2 жыл бұрын

    Thx now I know how to script a lot of sentences You are my fav scripting youtuber =)

  • @xperiorTR
    @xperiorTR3 жыл бұрын

    i wrote this while following the totorial this would have looked like machine gibberish before i followed the totorial you are a great teacher! team1 = "e" team2 = "a" team1score = 0 team2score = 0 minutes = 0 while minutes if minutes == 16 then print("its halftime now") wait(3) elseif minutes == 10 then team1score = team1score + 1 print("team 1 scored a goal") elseif minutes == 20 then team2score = team2score + 1 print("team 2 scored a goal!") elseif minutes == 25 then team2score = team2score + 1 print("team 2 scored another goal!!") else print(team1, team1score, team2, team2score) wait(1) end minutes = minutes + 1 end if minutes == 32 then print("the match has ended") elseif minutes print("the match didnt end yed") end if team2score > team1score then print("team 2 has won!") elseif team2score print("team 1 won!") end

  • @GnomeCode

    @GnomeCode

    3 жыл бұрын

    Great work!

  • @xperiorTR

    @xperiorTR

    3 жыл бұрын

    @@GnomeCode i couldnt have wrote it without your totorial! and please keep making these videos not only are they fun to watch they are also fun to follow and they teach a lot of stuff!

  • @Lilgical
    @Lilgical3 жыл бұрын

    Amazing! I’ve been looking for a tutorial like this for weeks! Thanks

  • @Raddius

    @Raddius

    Жыл бұрын

    That's a lie you just searched "how to script on Roblox" and found it.

  • @fireslime

    @fireslime

    Жыл бұрын

    @@Raddius i went through loop holes to get here. the search didnt lead my anywhere

  • @poisonousbadge126
    @poisonousbadge1263 жыл бұрын

    I thought you stopped lol awesome to know its back

  • @commonsquidtail
    @commonsquidtail3 жыл бұрын

    YOU ARE THE MOST BRILLIANT PERSON I KNOW! YOU HAVE ACTUALLY TAUGHT ME A LOT UNLIKE MANY OTHERS

  • @FTBALL136

    @FTBALL136

    9 ай бұрын

    Me too Thank you so much

  • @YungNoahX
    @YungNoahX Жыл бұрын

    this Tutorial though was very cool keep it up Gnome :D

  • @leeandrew9772
    @leeandrew97722 жыл бұрын

    So informative thank you.

  • @brush2418
    @brush24182 жыл бұрын

    You are amazing, I've learned so much

  • @TheGreatDuck_
    @TheGreatDuck_ Жыл бұрын

    This is so cool and im able to follow along however i think i will still have trouble making my own game.

  • @xMPCx
    @xMPCx Жыл бұрын

    Thank you! You teach me not only scripting in roblox but also English.

  • @trogg1426
    @trogg14263 жыл бұрын

    Gnone code is a goattt 🐐

  • @miamoon-8206
    @miamoon-82062 жыл бұрын

    Thank you this helped me alot!

  • @nickophobia5665
    @nickophobia5665 Жыл бұрын

    This is better than alvin blox. You actually get to make a game instead of learning boring scripting.

  • @funnelweb357
    @funnelweb3572 жыл бұрын

    this the best vid, i use to be a free modeler but i got sick of it and now scripting

  • @robotstar3876
    @robotstar387611 ай бұрын

    As a Qbasic beginner programmer, I can say this is quite easy to understand

  • @roblox_plays0rigin
    @roblox_plays0rigin2 жыл бұрын

    aaaayyyyyyyyyyyyyy ik how to do variables from last episode! KEEP IT UP BRO

  • @crosssans9984

    @crosssans9984

    10 ай бұрын

    same

  • @Poofart2024
    @Poofart20243 жыл бұрын

    I love gnome code!!!!

  • @smoll.p5364
    @smoll.p53643 жыл бұрын

    Back and better than ever

  • @Spiresnipers

    @Spiresnipers

    3 жыл бұрын

    Yep

  • @pinkumano5249
    @pinkumano52492 жыл бұрын

    ur very helpful thankx

  • @mr.eggyolk5469
    @mr.eggyolk54692 жыл бұрын

    This gives me an Idea of a game that you play in Roblox studio in the script

  • @imortalclashroyalespeedrun9275
    @imortalclashroyalespeedrun92753 жыл бұрын

    Could you do a tutorial how to do a power box if you turn it off all lights wont work and if you turn if back on the lights work again

  • @PivotGatto
    @PivotGatto3 жыл бұрын

    finally a new episode

  • @CappuccinoLol
    @CappuccinoLol2 жыл бұрын

    I’m right now making a obby! I tested it!it’s so good

  • @ziggy__9
    @ziggy__92 жыл бұрын

    another super vid

  • @AdrianPatrickPerez
    @AdrianPatrickPerez Жыл бұрын

    Thx helping a lot

  • @spookybunny9529
    @spookybunny95292 жыл бұрын

    Thanks! Now I know how to rig a football game so I always win :3

  • @GnomeCode

    @GnomeCode

    2 жыл бұрын

    That's the spirit!

  • @XtraSpeedy
    @XtraSpeedy3 жыл бұрын

    Finally After so lobg

  • @yonblox1171
    @yonblox11713 жыл бұрын

    how to redisplay the variable at the top of the script display? 10:28

  • @jameskiddasus2329
    @jameskiddasus2329 Жыл бұрын

    So while command is good for making boss respawn time

  • @AllCelebritiesSite
    @AllCelebritiesSite2 жыл бұрын

    Very useful

  • @ltsJustJay
    @ltsJustJay3 жыл бұрын

    ah mr gnome code i have been expecting you

  • @tokisheeesh
    @tokisheeesh Жыл бұрын

    POG intro

  • @valkor619
    @valkor6193 жыл бұрын

    Hey :). Could you tell me how you made the trains in Mafia city move by themselves or just rigging it? I have trouble making vehicles and I was wondering if you could do a vehicle tutorial or something, because they never work for me.

  • @GnomeCode

    @GnomeCode

    3 жыл бұрын

    The trains weren't rigged, they just use constraints to keep the sections together. I believe I covered a basic overview of how they work in the actual video.

  • @zainlol9153
    @zainlol91533 жыл бұрын

  • @greygartm4330
    @greygartm43303 жыл бұрын

    Finally 😄

  • @JustBntz
    @JustBntz2 жыл бұрын

    When i do it it just says something about this promise script or something i never even had a promise script and it didnt work

  • @quackywhackityphillyb.3005
    @quackywhackityphillyb.30053 жыл бұрын

    Gnomecode ; calls me cringe me cringe because I don’t know how to script . Me who already knows how to script but am watching this because i like gnomecode; (Sorry that i forgot the funny part)

  • @mrpunch1208
    @mrpunch12083 жыл бұрын

    Yessssssssssssssssss i can script (I haven't watched it yet lol)

  • @thestarwarsvault4434
    @thestarwarsvault44343 жыл бұрын

    Could you do a video on how to make a game like arsenal or a FPS.

  • @clocky1
    @clocky12 жыл бұрын

    on 7:47 Me: Let me run the game idk why GnomeCode 5 seconds later: DO NOT run or u might crash roblox studio!

  • @oglw364
    @oglw3642 жыл бұрын

    best roblox scripting channel

  • @kennethkline7702
    @kennethkline77023 жыл бұрын

    LOL, I forgot you were even doing these!

  • @GnomeCode

    @GnomeCode

    3 жыл бұрын

    Welcome back!

  • @onix3055
    @onix30553 жыл бұрын

    a gnome upload impossible

  • @piper000
    @piper0009 ай бұрын

    9:03 for me it printed 139,833 times and roblox studio still didnt crash. do I have an awesome pc like how?

  • @ahmet_9080
    @ahmet_90802 жыл бұрын

    end didnt show up on me

  • @LocusChronos
    @LocusChronos9 ай бұрын

    i don't know if you still respond to messages on these videos, but is there a way to incorperate RNG into the script you make in the latter half of the video. I'd love to have a random game happen in the output rather than have to code every single goal like seen at 18:59. I'm aware of math.random and i'm wondering how i can trigger something happening based on the resulting number. I feel that teaching us how to do this would have really added on to the video giving us a brief glimpse into the more advanced aspects of coding,

  • @GnomeCode

    @GnomeCode

    9 ай бұрын

    Yup, you can generate a random number between 1 and 10 like this: number = math.random(1,10) You could then have various if statements that change the outcome of the game depending on what the number is. Hope that helps!

  • @Voltralex
    @Voltralex Жыл бұрын

    19:23 When he said GOOOOOAL it sounded like technoblade's voice... TECHNOBLADE NEVER DIES

  • @arsenaleditfc
    @arsenaleditfc2 жыл бұрын

    says that we are cringe, but then teaches us how to 'not' be cringe... amazing

  • @SimplifiedZero
    @SimplifiedZero2 жыл бұрын

    he took maths class more than scripting

  • @EthanJCT
    @EthanJCT Жыл бұрын

    I don’t understand the word closing on line 7 and stuff to close “)”

  • @stroyosh4670
    @stroyosh46703 жыл бұрын

    Wow now that’s a deal

  • @CappuccinoLol
    @CappuccinoLol2 жыл бұрын

    It’s still in progress

  • @YungNoahX
    @YungNoahX Жыл бұрын

    another way for the printing you could use is this: myName = "Noah" if myName == "Noah" then print("Hello My Name Is "..myName) else print("My Name Is Not "..myName

  • @YungNoahX

    @YungNoahX

    Жыл бұрын

    Did it work?

  • @unknonanimator
    @unknonanimator3 жыл бұрын

    YAYYYY

  • @cristiandrei2479
    @cristiandrei2479 Жыл бұрын

    Best thing for passwords

  • @meepwagon8031
    @meepwagon80313 жыл бұрын

    Gnome Gode

  • @templars44
    @templars443 жыл бұрын

    what editing software you used?

  • @GnomeCode

    @GnomeCode

    3 жыл бұрын

    I use Hitfilm Express for all my videos

  • @AlbertAlbertEinstein
    @AlbertAlbertEinstein6 ай бұрын

    15:24 i kinda managed to fix the problem, i just wrote this: team1 = "ChadBacons" team2 = "CringySlenders" team1Score = 0 team2Score = 0 minutes = 0 while minutes if minutes == 45 then print("HALF TIME") wait(3) elseif minutes == 90 then print("FULL TIME") else end print(team1, team1Score, team2, team2Score) minutes = minutes + 1 print(minutes) wait(0.2) end

  • @Spooky.Studios
    @Spooky.Studios3 жыл бұрын

    number = 6 done = false while number > 3 do if done == false then print(number.. " is still greater than 3") number = number - 1 elseif number done = true end end (just to use the script without making ur studio crash basically it will make the number go down until it becomes 2 cuz it will no more be greater than 3 idk if it works i didn't try it since i just made the script inside the youtube comments)

  • @GnomeCode

    @GnomeCode

    3 жыл бұрын

    Almost! You would need to define your 'done' variable at the top

  • @Spooky.Studios

    @Spooky.Studios

    3 жыл бұрын

    @@GnomeCode yeah i did forget it

  • @hoodratthizzkid4316
    @hoodratthizzkid4316 Жыл бұрын

    Line 15 won't work for me

  • @ryansupersonics9019
    @ryansupersonics9019 Жыл бұрын

    So I ran it with the while loop. R.I.P My Save

  • @nattwilliams855
    @nattwilliams8552 жыл бұрын

    GnomeCode: Yeah so don't run this code me who already ran it: uhhh

  • @Philsosopher
    @Philsosopher3 жыл бұрын

    🥳🥳

  • @esculayte661
    @esculayte6613 жыл бұрын

    73 likes and 0 dislikes, thats how you know this is a good video

  • @esculayte661

    @esculayte661

    3 жыл бұрын

    @TheRandom Player 101*

  • @esculayte661

    @esculayte661

    3 жыл бұрын

    @@HarryDKH 113

  • @crosssans9984

    @crosssans9984

    10 ай бұрын

    1.1k *

  • @esculayte661

    @esculayte661

    9 ай бұрын

    @@crosssans9984 dawg this comment is from 2 years ago

  • @spon._.
    @spon._.2 жыл бұрын

    "Whaaaa? its 2021 and you still haven't know how to script?! you are cringe!" me that just started learning in 2022:

  • @RakisahNew
    @RakisahNew Жыл бұрын

    8:51 mine printed 68039 times before giving up

  • @sentina2
    @sentina22 жыл бұрын

    Mine didn't loop

  • @abedasultanamostshilpy3791
    @abedasultanamostshilpy37913 жыл бұрын

    GnomeCode can you do chapter 4 the sewers

  • @projectmint1608
    @projectmint16082 жыл бұрын

    im having fun scripting for some reason lol

  • @TheRobloxGameDev
    @TheRobloxGameDev2 жыл бұрын

    Anybody else heard a cat meowing or is it just me 6:46

  • @realcinnamongold
    @realcinnamongold Жыл бұрын

    Me who ran the while loop before he said not to: ;-;

  • @ElderWizard
    @ElderWizard3 жыл бұрын

    Where is Teddy chapter 3 speed build? Please respond

  • @GnomeCode

    @GnomeCode

    3 жыл бұрын

    On my hard drive. All 30 hours of it.

  • @ElderWizard

    @ElderWizard

    3 жыл бұрын

    @@GnomeCode ok

  • @meepwagon8031
    @meepwagon80313 жыл бұрын

    Gnome

  • @flares7574
    @flares75743 жыл бұрын

    Wait, new video? IMPOSSIBLE

  • @uzixson
    @uzixson3 жыл бұрын

    I did not understand:( but the video is top :) 🌿

  • @crosssans9984

    @crosssans9984

    10 ай бұрын

    why

  • @mrjayden_
    @mrjayden_2 жыл бұрын

    5:58 don’t mind me saving time stamps lol

  • @isuperfy
    @isuperfy2 жыл бұрын

    i paused the video and tried to run the while code like 6 times hahahahaha

  • @Vynx__
    @Vynx__6 ай бұрын

    9:00 aight bro we get it , 5 > 3 ☠

  • @Slowezt
    @SloweztАй бұрын

    sorry my brain got exploded.

  • @rageguy5529
    @rageguy552910 ай бұрын

    Bread

  • @Gwasty
    @Gwasty2 жыл бұрын

    my brainn is fried but i still understood everything u said and... FOR SOME DUMB REASON U CAN TEACH US THE UNTEACHABLE HOW XD?

  • @agamingchannel2
    @agamingchannel23 жыл бұрын

    aye

  • @alackofskill
    @alackofskill10 ай бұрын

    I immediately pressed run on the script that we were not supposed to run and I completely crashed my entire computer

  • @semihaslan7918
    @semihaslan79183 жыл бұрын

    yeah its cringe but what coding language is this? I really like this one

  • @Unlucky-9172
    @Unlucky-91722 жыл бұрын

    11,111 views, nice

  • @doggonoes2810
    @doggonoes28106 ай бұрын

    12:35

  • @mikelcraft3.069
    @mikelcraft3.069 Жыл бұрын

    8:13 "DO NOT RUN THIS CODE" Me who's already ran the code

  • @user-ki3hy5tg4v
    @user-ki3hy5tg4v10 ай бұрын

    ayo you wroted the script in 26 lines and i wrote it in 37

  • @musembifamily1318
    @musembifamily13184 ай бұрын

    if theres anything you guys dont understand ask me

  • @bigman-mr2vb
    @bigman-mr2vb Жыл бұрын

    what do i do when this message shows up ;'' Downloading asset failed for asset id 5112309884. Is the asset id correct and is the asset type "Model"?''? it keeps on happening and i think it prevents my scripts form working.