Scoping - Roblox Beginners Scripting Tutorial #9 (2024)

  Рет қаралды 56,320

BrawlDev

BrawlDev

Күн бұрын

Пікірлер: 431
@daniel_denamit724
@daniel_denamit724 4 ай бұрын
crazy that by just looking these videos one by one you see how the views go down and how many people quit this tutroial if you made to this point be proud of your self😁!
@Random_sshitt
@Random_sshitt 4 ай бұрын
true that
@HugeDevGames-o2x
@HugeDevGames-o2x 4 ай бұрын
people that are still here
@Mickoir
@Mickoir 4 ай бұрын
Same, I'm trying my best after giving up a year ago I'm trying again and seeing how it works out, as someone who doesn't know jack about coding, if someone else can learn it then that means I can too. It takes time and effort. Slow and steady wins the race.
@coolkid7377
@coolkid7377 4 ай бұрын
@@Mickoir yea i hate learning but at the same time i love coding, so it balances it out for me
@CatsAreCool422
@CatsAreCool422 4 ай бұрын
@@coolkid7377 its also quite fun and interesting
@snapdragon8723
@snapdragon8723 3 ай бұрын
For those still having trouble with this part look at the sniper scope example I have provided below. Sniper scope is the most zoomed in when defining a local variable in a function or if statement. (only seeing the head of a dummy) A sniper scope is less zoomed in when you define a local variable in a script. (this range can see the entire body of the dummy.) A sniper scope is the least zoomed in when using a global variable. (this range can see not only the body of this dummy but also many other dummies.) This example is best when used with visuals of a sniper scope training itself on a dummy and then zooming out to see the entire dummy, before finally zooming out to see many dummies. (Unfortunately, I cannot provide an example of such visuals.) You can also provide a similar idea with binoculars or microscope. Edit: I just wanted to add that I thought of a joke you could do where the sniper scope is zoomed in on just a single dummy that has a global variable with the person looking through the scope saying, "A global variable? Were the hell else is this going to be used-" and as they say "used-" they zoom out to see more dummies using the variable and then stop looking through the scope to see an army of dummies using the variable before saying, "Oh, shi-"
@YassinDapruu
@YassinDapruu 2 ай бұрын
That was a good explanation, to be honest, and you helped me to recognize it, thanks.
@lekkieplayzzz
@lekkieplayzzz Ай бұрын
thx for the explanation and make the joke a meme pksssssss
@bacon_yuji
@bacon_yuji 18 күн бұрын
yea i still dont understand but thanks
@osakadev
@osakadev 5 ай бұрын
I'm at school watching this video, priorities
@الخلبوصة
@الخلبوصة 5 ай бұрын
and im staying up till 4:19 AM just to have the chance to watch this, still priorities
@YellowYarn
@YellowYarn 5 ай бұрын
and I’m staying up till. 4:19 AM just to have the chance to watch this, still priorities (chain)
@NicolasLae-u8s
@NicolasLae-u8s 5 ай бұрын
@@YellowYarn and I’m staying up till. 4:19 AM just to have the chance to watch this, still priorities (chain)(chain)
@realjackbruhman
@realjackbruhman 5 ай бұрын
@@NicolasLae-u8s and I’m staying up till. 4:19 AM just to have the chance to watch this, still priorities (chain)(chain)(chain)
@prodbyjackpit
@prodbyjackpit 5 ай бұрын
and im staying up till 4:18 AM just to have the chance to watch this, still priorities (oop mb)
@Derpysaiyan
@Derpysaiyan 4 ай бұрын
i know a bit about coding already so I'm skimming through some of this, just learned the concept of scoping but it's crazy to me how the views have slowly died down lmfao, yall need to keep going strong 💪
@chosentendency6004
@chosentendency6004 Ай бұрын
im just lazy sometimes
@LaufzDS
@LaufzDS 4 ай бұрын
Mate you are amazing at teaching. local function levelOfGyatts() local result = 100 if result == 100 then local thisresult = true print ("thisresult") else local that result = false print ("thatresult") end end levelOfGyatts()
@kingstyn
@kingstyn 4 ай бұрын
level of gyatts? lol
@marwanatta
@marwanatta 2 ай бұрын
level of what😭🙏
@Remeashbanton
@Remeashbanton Ай бұрын
Naaaah 😂 💀 bros wasting his skill with Brian rot 🙏🙏
@Buddy_the_dog_Man
@Buddy_the_dog_Man Ай бұрын
NAHHHHHHHHHHHHHHHH💀
@phase-u1q
@phase-u1q Ай бұрын
@@Remeashbanton if he adds brainrot doesnt mean he is wasting his skill plus it has to be a fun experience learning not just watching and doing normal things
@SimplyTutuco
@SimplyTutuco 2 ай бұрын
This was SUPER easy to understand! :D Here's what I did: local daCoolestVariable = 123 local function coolnessFunction() local coolnessResult = daCoolestVariable * daCoolestVariable + daCoolestVariable print(coolnessResult) if coolnessResult == 15252 then local epicnessAmount = coolnessResult * coolnessResult * daCoolestVariable print("Your epicness amount is ", epicnessAmount) else local awesomenessAmount = coolnessResult / 2 print("Your awesomeness amount is ", awesomenessAmount) end end coolnessFunction()
@skil1ed_2011
@skil1ed_2011 4 ай бұрын
Ur incredibly underrated. It's so easy to understand what point you are trying to make. Keep up the good work 😊👌
@loonificated
@loonificated 4 ай бұрын
not gonna lie, this one is the most tricky one so far, but even then you make it much easier to understand, thank you!
@Cole_22
@Cole_22 4 ай бұрын
As a beginner this is the first lua tutorial I actually understand
@HugeDevGames-o2x
@HugeDevGames-o2x 4 ай бұрын
FAXXXX
@TH_amir
@TH_amir 29 күн бұрын
Fr he's explaining so well
@koziloll
@koziloll 5 ай бұрын
I watched every single DevKing video advanced and beginner and still didnt fully get scripting, ive just started watching you and i already know more than i used too.. great channel definitely recommend
@Vertect
@Vertect 5 ай бұрын
Yes amazing, I watched his videos a few times over and got the basics, but he always made mistakes in his videos and wasn't all too concise. BrawlDev is to the point and easy to understand.
@HugeDevGames-o2x
@HugeDevGames-o2x 4 ай бұрын
@@Vertect fax
@CatsAreCool422
@CatsAreCool422 4 ай бұрын
it also turns out nice and slow, giving powerful scenarios and examples too. even learning objectives.
@nathanallred663
@nathanallred663 4 ай бұрын
same bro he gets more detailed its awesome like into this folder like the game. into the workshop. into the item like the part then u can say part.material = " Brick" or whatever its so nice
@ghosthunterroblox2549
@ghosthunterroblox2549 4 ай бұрын
Bro im actually learning script a thing that i tought i would never learn tysm! One day i watch your tutorials then i practice and then practice again and watch you tutorials this is helping me so much! I hope you get 11k subs!
@HugeDevGames-o2x
@HugeDevGames-o2x 4 ай бұрын
keep up the work!
@tremurra
@tremurra 4 ай бұрын
hows the progress going?
@ghosthunterroblox2549
@ghosthunterroblox2549 4 ай бұрын
@@tremurra good!
@cafrican8000
@cafrican8000 11 күн бұрын
1:48 my sus brain really thought 😂😂
@Magnificent_Potato
@Magnificent_Potato 2 күн бұрын
You are most likely the best youtuber i have every watched to learn to script. You have helped me so much with my journey on game development!
@Rax_Way
@Rax_Way 3 ай бұрын
now this is where it got hard att first i tought lua basics would be easy but now its getting hard however after looking att some comments and practicing am learning more about scoping its about practice ive you ever feel like its to hard keep watching and practicing because you will face many fails but theres nothing stopping you to become a roblox dev
@swordzendile
@swordzendile 2 ай бұрын
thanks i’ll update you on my journey in a week
@RA-zn9uu
@RA-zn9uu 2 ай бұрын
@@swordzendile almost a week
@swordzendile
@swordzendile Ай бұрын
@@RA-zn9uu i quit btw. roblox is pretty dumb anyways
@RedditMaster-gq8tl
@RedditMaster-gq8tl 23 күн бұрын
@@swordzendile Dont quit man keep on going
@Zynxifier
@Zynxifier 3 ай бұрын
YEEEESSSSSS 15K SUBS CONGRATS BRAWLDEV!!!
@Wackygd
@Wackygd 3 ай бұрын
these series of videos are the most helpful ive ever seen this is the script i made from this video local mysecondvari = "string" if mysecondvari == "string" then local number99 = true print(number99) elseif mysecondvari == "string" then local number100 = false print("number100")
@nzm_f6425
@nzm_f6425 3 ай бұрын
If you are printing values inside a variable by writing the variable. It's without quotation
@darblox1366
@darblox1366 Ай бұрын
for those who don't understand heres a summary:- A global variable is a variable that can be defined and you can use it from anywhere in your script(a global is basically any variable that isn't local,so taking off the local modifier makes it global.) A local variable is a variable that can only be used in the block of code that it’s in.(meaning if you wanna access it from other scripts it won't work either. It would have to be redeclared under a different variable.) if it’s outside of a block of code(i.e a function) then it has been declared and it works throughout the script. why does'nt printing a variable work before i write the variable? take it as reading a book. if i ask you what happens at the end before you read the book, you wouldn't know. same thing applies to the script the script is read from top to bottom, so if you try printing something before its even introduced it wont work and will give you an error.
@CatsAreCool422
@CatsAreCool422 4 ай бұрын
local function Scoped() local result = 72 local answer = 42 if answer + result == 114 then local printing1 = true print(printing1) else local printing2 = false print(printing2) end end Scoped()
@DudeDaMonkey
@DudeDaMonkey 5 ай бұрын
bro what underrated videos 👍
@astrorett
@astrorett Ай бұрын
This video made so much sense! Thank you so much!!
@yourlocaldoormat
@yourlocaldoormat 4 ай бұрын
local sigma = 50 local beta = 10 local function auraBattle() if sigma => beta then sigma = true print("SIGMA HAS MORE AURA") else sigma = false print("SIGMA HAS LOST THE AURA BATTLE") end end auraBattle()
@redithorror-p6t
@redithorror-p6t 4 ай бұрын
this is so corny bro
@yourlocaldoormat
@yourlocaldoormat 4 ай бұрын
@@redithorror-p6t who gives a fuck if I'm writing 500+ lines of code for a battlegrounds game. It's satire and I didn't have any idea for other variables. Make yourself of use by not bothering me.
@pryt0n180
@pryt0n180 4 ай бұрын
@@yourlocaldoormat if @normalperson8743 == is a cornball then @normalperson8745:Destroy() end
@Smite_1
@Smite_1 4 ай бұрын
@@yourlocaldoormat Well, Someone is mad
@yourlocaldoormat
@yourlocaldoormat 4 ай бұрын
@@Smite_1 im mad at some lazy ass spending his time looking through comments on a scripting tutorial. I'm literally making a game and written over 750 lines of code now. I've coded punching, dashing, blocking, sprinting and more. I have a team working on the game that includes animators, modellers, concept artists, digital artists and more. If your gonna be watching videos like this put it to use and do something with your life.
@antoinethelark
@antoinethelark 5 ай бұрын
love this series. been trying to learn scripting forever and none of the other tutorials helped. this is actually helping me. soon i can build and script
@Poutto
@Poutto 5 ай бұрын
HELL YEAH ANOTHER UPLOAD
@laptopcryptoinsane
@laptopcryptoinsane 5 ай бұрын
Bro this channel is so underrated new sub
@glitcharmy8
@glitcharmy8 5 ай бұрын
Fr fr
@Nana-vo5jf
@Nana-vo5jf 22 күн бұрын
local dark = game.Workspace.Baseplate local function hi() local result = nil if result == true then dark.Material = "Grass" end if result == nil then dark.Material = "Brick" end end hi() bro tysm it works
@eclergt9926
@eclergt9926 5 ай бұрын
I'd add something to this, if your variable is tied to a function or if/else statement, you can reuse that variable name if you are out of the scope of that function/if, else. So for example, like he has in his video, in the if he named his var result1 and in the else result2, but he couldv used result1 as a name again in the else statement. Hopefully I made this clear enough for people to understand.
@rusydanroslen6606
@rusydanroslen6606 Күн бұрын
thank you brawldev for this amazin video :D
@nonaplayz4789
@nonaplayz4789 5 ай бұрын
Lovee ur way of explaining! Really u made things easier for me as a begginer! Tysmmmm
@HugeDevGames-o2x
@HugeDevGames-o2x 4 ай бұрын
fax
@Kyoryokuna_Fallen
@Kyoryokuna_Fallen 4 ай бұрын
another great video 😊very fun.
@bradenknipp9362
@bradenknipp9362 3 ай бұрын
9:10 so how would you access the value if you wanted to? would it be as simple as just not putting local? if so then why put local in the first place what are the downsides of not putting local
@Berrvishim
@Berrvishim Ай бұрын
thank you for helping me code and learn somthing ive been wanting to learn for ages
@B0MSH1K
@B0MSH1K Ай бұрын
These videos are allowing me to learn scripting thank you so much, also here is my learning objective :) local function skibiditoilet() local result = "I love skibidi toilet!" if result == "I love skibidi toilet!" then local result1 = true print("He loves skibidi toilet!") else print("He does not love skibidi toilet! :(") end end skibiditoilet()
@bananadude699
@bananadude699 18 күн бұрын
My guy deserves more ngl
@draivitz
@draivitz 4 ай бұрын
Had fun with the if statements by making a jackpot print, hope I have fun with the rest of these tutorials
@JoeyDixonNixon
@JoeyDixonNixon 5 ай бұрын
since i already have learned scoping last episode i have nothing here :p Btw your videos are great!
@cutesy2282
@cutesy2282 Күн бұрын
Oh how?
@cakeobear
@cakeobear 4 ай бұрын
🔥🔥🔥🔥🔥🔥
@LertsPlays
@LertsPlays 4 ай бұрын
bro thank you so much you are helping me undertand at the beginning of today i didnt even know what like local and all that stuff was now i fully understand
@HugeDevGames-o2x
@HugeDevGames-o2x 4 ай бұрын
keep up the good work i believe in you!
@SLick31
@SLick31 3 күн бұрын
local function ArcerosDamage () local result = 110 if result == 10 then local resultis = false print("resultis") else local result = true print("resultis") end end ArcerosDamage() -- for anyone wondering what Arceros is it's creature from pokemon game from roblox loomian legacy. it carries me
@boxblox1986
@boxblox1986 5 ай бұрын
local myGrades = math.random(1,100) local function passGrades() return 90 end if passGrades()
@VersatileMC
@VersatileMC 4 ай бұрын
Your program is correct and it successfully gives an output But the main topic covered in this video is about whether the program is able to recognize different variables For example if you created the "myGrades" Variable first inside the "passGrades()" Function While the program is comparing if passGrades() function is
@bonbon620
@bonbon620 2 ай бұрын
bro how do u not have more then 1m subs. you are like the Kohl of youtube
@BoredAsf.
@BoredAsf. 4 ай бұрын
--scoping is when you make a variable inside a function, which makes it so you cant use that variable outside of the function. -- even if you try to call it, it will not work. and when using "else" it wouldnt work. only when used in the variable. --my own scoping: local function MyCoolFunctionGYATT() local result = 100 if result == 100 then local result1 = "GYATT" print(result1) else local result2 = "NOT GYATT" print(result2) end end was this good?
@anchor7549
@anchor7549 3 ай бұрын
local function simpleAdd(number1, number2) local result = number1 + number2 if result < 5 then local answer1 = "the result is smaller than 5" print(answer1) elseif result > 5 then local answer2 = "the result is greater than 5" print(answer2) end end simpleAdd(1, 10) simpleAdd (1, 3)
@barry0_0
@barry0_0 3 ай бұрын
im a big fan bro
@anchor7549
@anchor7549 3 ай бұрын
@@barry0_0 thank you
@lolghost5041
@lolghost5041 2 ай бұрын
local function countdown(number) local time = number if time > 0 then time = time - 1 print(time) countdown(time) elseif time == 0 then print("countdown successful") else print("countdown failed") end end countdown(20)
@zolfoxgaming4144
@zolfoxgaming4144 2 ай бұрын
like i started without knowing anything about coding but with this knowledge I can kind of do it now (well a little bit of it ig). But i still struggle with it alot but i can't thank you enough for these tutorials lol
@liamm__.18
@liamm__.18 Ай бұрын
local function thingy() local result = 10 if result == 10 then local result1 = "it is indeed 10!" print(result1) else local result2 = "it is not 10." print(result2) end end thingy()
@scratchystuff
@scratchystuff 12 күн бұрын
first tourtarial that properly teached me :D
@not_void_line
@not_void_line 3 ай бұрын
7:25 am i scizo or did his voice just double
@banditbaws
@banditbaws Ай бұрын
print(myVariableOne) myVariableOne = 'Hello' local function myFunctionOne(num1,num2) local result = num1+num2 if result >= 5 then local myVariableTwo = 'What a big number!' print(myVariableTwo) elseif result
@YiChenWang-f2b
@YiChenWang-f2b 14 күн бұрын
local a1 = "a1, a2, and a3 are basically a global code which can be used to all. b1 is a local code, which can be used only inside the local function." local a2 = 2 + 2 local a3 = true local function b1(n1, n2) local result = n1 + n2 if result == 10 then local c1 = "The answer is 10!" print(c1) elseif result == 12 then local c2 = "The answer is 12!" print(c2) else local c3 = "None of the choices are the correct!" print(c3) end if result == 10 then local c4 = "The second 10 is correct!" print(c4) elseif result == 12 then local c5 = "The second 12 is correct!" print(c5) else local c6 = "None of the choices are correct. Please try again later!" print(c6) end end print(a1) b1(5, 5) b1(6, 6) b1(7, 7)
@Chtto88
@Chtto88 5 ай бұрын
These videos are goated
@aphodemin
@aphodemin 4 ай бұрын
-- based on the paradox that is pinnochio says his nose is going to grow. local theTruth = 1 local notTheTruth = 1 local function imLying(truth, lie) local result = truth + lie if result == 2 then print("Paradox") end end imLying(theTruth,notTheTruth )
@averagecwplayer7908
@averagecwplayer7908 Ай бұрын
local Result = 9 --i changed this number to check local function testing() if Result == nil then local Result1 = print("Number is nil!") else local Result2 = print("Number is not nil") end end testing()
@lgc-d7o
@lgc-d7o Ай бұрын
i love roblox coding tutorials. local function mycoolfunction() local result = nil if result == nil then local result = true print(result) else local result2 = false print(result2) end end mycoolfunction() wait(5) print("Thanks BrawlDev! Due to you im getting better at coding!") -- Scoping is refrencing to the code block on where a string of code is stationed. --If you attempt to create or print a string of code -- onto another variable/function, it will not work due to this variable/function -- not existing, so Roblox renders it as an error.
@Stepnpro2
@Stepnpro2 2 ай бұрын
the best 🙃🙃
@Nxmt-s2j
@Nxmt-s2j 8 күн бұрын
local function amazing() local result = 1 if result == 1 then local result1 = 10 if result1 == 10 then print("very kewl that the result1 is " .. result1) print("Result original is equal to " .. result) end end end amazing() That is my code :)
@gamerloss8491
@gamerloss8491 20 күн бұрын
well global variables if used properly can actually be good since will optimize the script. since each letter cost bytes and space. using global kinda remove some
@fangyongsun7182
@fangyongsun7182 14 күн бұрын
Hey wait. what about undefined? isn't that a value? I mean I know some javascript but doesn't lua have undefined?
@SabrosoShantee34
@SabrosoShantee34 4 ай бұрын
hey i got a question what are your theme colors
@BeardedWaleed
@BeardedWaleed 3 ай бұрын
you are A Legend
@EEAASSEE
@EEAASSEE 27 күн бұрын
local a = 1 local function function1() local value = 1 if value == 0 then result1 = true print(result1) else result2 = false print(result2) end local value2 = 3 if value2 == 3 then result3 = true print(result3) else result4 = false print(result4) end end function1()
@personguyIII
@personguyIII 3 ай бұрын
local function function1() local variable1 = 3+1 if variable1 == 6 then print("its 6") elseif variable1 == 4 then print("its 4") end end function1()
@diabooteez
@diabooteez 4 ай бұрын
I haven’t been to sleep it’s 6 in the morning I’m getting upset bc I can’t keep up, not your fault tho great videos!! They explain perfectly😃👍
@SneakyFrog-p3j
@SneakyFrog-p3j Ай бұрын
an easier way to explain local functions is like saying if there is a end on the code that is where it ends that part and if outside with local errors the script wont work
@spiniks893
@spiniks893 4 ай бұрын
local function Test() local result = nil if result == nil then local result1 = true print("yes") else print("No") end end print(result1) Test() correct : local function Test() local result = nil if result == nil then local result1 = true print("yes") print(result1) else print("No") end end Test()
@Robloxglitches-e7e
@Robloxglitches-e7e 3 ай бұрын
And I'm watching this video over and over again so I won't miss a concert because my code doesn't have any errs but in the console it doesn't say anything
@soyyoluca5248
@soyyoluca5248 3 ай бұрын
Did you remember to call the function after stating it??
@faintvolley
@faintvolley 3 ай бұрын
next lesson has been completed and I'm still pushing for more! local function catGirlsNyah() local Result = 150 if Result == 150 then local Result1 = true print("Correct!") else local Result2 = false print("Erm... Something doesn't seem quite right, go check your answer again.") end end catGirlsNyah()
@raghunathchaudhari8727
@raghunathchaudhari8727 Ай бұрын
local theVariable = "This is a variable" -- this variable can be used in anywhere in function or events local function myFunction() local variable1 = "This is another variable" -- This variable can't be used outside of the function if variable1 == "This is another variable" then local result = "!" -- This variable can only used in this code block print(result) else local result2 = "?" -- This variable also used in this code block only print(result2) end end
@LASER10-l7o
@LASER10-l7o 4 ай бұрын
Is it possible to make a variable accessible on all different scripts? If so, how?
@prodbycotax
@prodbycotax 2 ай бұрын
remove local cuz local makes it tied to the script u used it in and if you remove it it becomes global meaning it can be used in all scripts it becomes a global variable but i dont recommend it like he said in the vid
@Naz-tj2hv
@Naz-tj2hv 2 ай бұрын
@@prodbycotax why, wouldn't it be useful since u dont need to define a local variable with the same value if ur using it throughout multiple scripts?
@FireLord-sn4lu
@FireLord-sn4lu 3 ай бұрын
local bPlate = game.Workspace.Baseplate local tTop = game.Workspace.Table.Tabletop local function bPlateVal2() bPlate.Transparency = math.random(0, 1) --not practical but im trying to get it to choose between 0 and .5 and math.random doesnt want to pick decimals and other methods pick a range. return bPlate.Transparency end local bPlateValCheck = bPlateVal2() print(bPlateValCheck) local function bPlateFunc2() if bPlate.Transparency == 0 then bPlate.Material = "Slate" elseif bPlate.Transparency == 1 then bPlate.Transparency = 0 bPlate.Material = "Brick" end end if bPlateValCheck == 0 or 1 then bPlateFunc2() end print(bPlate.Material) Is this acceptable in anyway shape or form?
@sagiqiux
@sagiqiux 2 ай бұрын
local function clogged() local result = 100 if result == 100 then local result1 = true print(result1) else local result2 = false print(result2) end end clogged() I forgot to end the function first try so I was confused
@Yoni_Roblox
@Yoni_Roblox 2 ай бұрын
local function ddd() local result = nil if result == 4 then local result2 = true print(result2) else local result3 = false print(result3) end end ddd()
@zeusen9466
@zeusen9466 9 күн бұрын
i love u brawl dev
@waltertrollge4418
@waltertrollge4418 Күн бұрын
I'm not sure if this is a scoping, but the code worked! i only added a few locals(variable) inside the function and added "return" to end the function. local Level = 100 local Alright = true local function Aura() local result = Level local Yea = Alright if result == Level then return Yea end end local AuraLevel = Aura() print(AuraLevel)
@FJGamer1st
@FJGamer1st 3 ай бұрын
This is fire 🔥 (chain) ⬇
@yumenokoyume
@yumenokoyume 3 ай бұрын
Why is it important to put variables where it should be. What will happen if all variables are global. I'm a newbie in programming. I put my variables everywhere, my program is such a clutter, I variable almost everything outside or globally.
@BalintZsoldos
@BalintZsoldos 4 ай бұрын
omg this is help so mutch
@TaylanAcar-m2p
@TaylanAcar-m2p Ай бұрын
local function healthBar() local result = 100 if result == 100 then local TheResult = true print(TheResult) print("The resule is at max health") else local TheResult = false print(TheResult) print("The health is low!") end end healthBar()
@Rei_Blitz
@Rei_Blitz Ай бұрын
Keeping up frrr local function scriptBlock () local result = nil if 0+5 == nil then local block = game.Workspace.Part1 print("Block 1 identified") else local block2 = game.Workspace.Part2 print("block2 has been identified") end end scriptBlock()
@JacksonHostutler-ln8ji
@JacksonHostutler-ln8ji 2 ай бұрын
A function to see if a number is positive, negative, or 0.
@doge4101
@doge4101 Ай бұрын
Y'all i have a question, is nil also the same as zero, for instance if i do math and i get 0, when i am checking is that variable is 0 can i use nil?
@JesseMinecraftXD
@JesseMinecraftXD 4 ай бұрын
And then there's me thinking you were referring to aiming with a gun. XD
@Krycco
@Krycco 2 ай бұрын
local function calculate(Number1, Number2, SelectedMath) --peak calculator... ignore the fact it only calculates the bare minimum local Result = nil if SelectedMath == "addition" then Result = Number1 + Number2 elseif SelectedMath == "subtraction" then Result = Number1 - Number2 elseif SelectedMath == "multiplication" then Result = Number1 * Number2 elseif SelectedMath == "division" then Result = Number1 / Number2 end if Result < 100 then local lessThan100 = true print(lessThan100) elseif Result > 100 then local biggerThan100 = true print(biggerThan100) end return Result end local CalculationResult = calculate(10, 5, "addition") print(CalculationResult)
@LolmYT
@LolmYT 3 ай бұрын
the only tutorial i suck at is if statements local function cats() local result = 50 if result == 50 then print("50 cats") else if result2 == 20 then print("20 cats") end end end cats()
@GodzillaEditzSimpile
@GodzillaEditzSimpile Ай бұрын
if yes.Color == Color3.fromRGB(255,255,255) then yes.Color = Color3.fromRGB(242, 62, 255) print("color has been changed") else yes.Color = Color3.fromRGB(255,255,255) print("Failed! color has set to white") end end yes2() I M learning it in on EP 9 dang yayyyyyyy
@alexandrecezar3029
@alexandrecezar3029 2 ай бұрын
Você é incrivelmente bom ensinando, eu to usando a legenda automatica do KZbin e mesmo assim to conseguindo aprender com as suas aulas, muito obrigado!
@cxry2953
@cxry2953 4 ай бұрын
local function sub(n1, n2) local res = n1 - n2 if res == 4 then local aRes = res + 1 print(aRes) elseif res == 5 then local bRes = 6 print(res + bRes) else print("The script failed") end end sub(7,2)
@chaloemsak1010
@chaloemsak1010 5 ай бұрын
FC , from Thailand . 💕😁
@HarryHobbleton
@HarryHobbleton 6 күн бұрын
I hope this code gives a little help to those who are finding this tricky! local function Mindset() local Try = 500 local GiveUp = 1 if Try - GiveUp == 499 then print("You Can Do this!") else print("You cant do this.") end end Mindset()
@pizzabean
@pizzabean Ай бұрын
local function mygoodfunction () local result=nil if result==nil then print("their is no result") local result1=true elseif result==4 then print("the result is 4") local result2=true else print("this number was not recorded") local result3=false end end
@TrygveJF
@TrygveJF 5 ай бұрын
So that's why I get an error in my function, because I forgot to add "local" lol (yet it still works though) Thanks for the explanation, Brawl!
@wakashade1235
@wakashade1235 3 ай бұрын
is there a way to create a variable in one script and then access it in another (without remote events)
@GetMetaLockedUP
@GetMetaLockedUP 21 күн бұрын
my variable : local function Transparency() local result = 0.25 if result == 0.23 then local result1 = false print(result1) else local result2 = true print(result2) end end Transparency()
@dweezie802
@dweezie802 Ай бұрын
local myGlobalVariable = "Hello, im global"--Global Scope local function myLocalVariable() local myLocalVariable = "Hello, im local"--Local Scope print(myLocalVariable) if myLocalVariable == "Hello, im local" then local result1 = true print(result1) else local result2 = false print(result2) end end myLocalVariable()--output: Hello, im local print(myGlobalVariable)--output: Hello, im global print(myLocalVariable)--output: error: myLocalVariable is not defined
@FantaSYTheSecond
@FantaSYTheSecond 5 ай бұрын
Your tutorial guides are amazing! print(Cool) local Cool = "funny" -- this is incorrect local Cool1 = "Notfunny" -- this is correct print(Cool1)
@slayr5585
@slayr5585 6 күн бұрын
local function m1() local R1 = 0 if R1 == 0 then local R34 = true print(R34) else local R24 = false print(R24) end end m1()
@eljaitor8558
@eljaitor8558 2 ай бұрын
local function funcion(n1,n2,n3,n4) result1 = n1 + n3 result2 = n2 + n4 result3 = n2 - n4 if result1 + result2 == 5 and result3 + 2 == 5 or result2 + result1 == 6 then print("you found the numbers, well done") else print("sorry but this isn´t the numbers") end end funcion(2,3,0,0) local function funcion2(n21,n22,n23) result21 = n21 + n22 resutl22 = n21 + n22 + n23 if resutl22 + result21 == 7 or resutl22 + result21 == 6 then print("womp pomp") else print("baaaa") end end funcion2(2,1,1)
@nikagamer3148
@nikagamer3148 Ай бұрын
i am new and i now js and that's ez scripts to me
@الخلبوصة
@الخلبوصة 5 ай бұрын
I still don't really understand why I should use 'local trueStatement' instead of 'trueStatement' without local. Does the reason matter? Or should I just use local?
@kidthisman4556
@kidthisman4556 5 ай бұрын
the reason is that its easier for the computer to understand so just use local its better
@الخلبوصة
@الخلبوصة 5 ай бұрын
@@kidthisman4556 Alright. Thank you|!
@sonicvr4400
@sonicvr4400 Ай бұрын
local function skibidi() local result = 25 + 25 if result == 50 then print("skeebeedee!") elseif result == 75 then local result2 = "skeebeedeeist!" print(result2) end end skibidi()
@kaymaximoff8162
@kaymaximoff8162 2 ай бұрын
local function Incendia(number1, number2) local result = 20 local result = number1 + number2 if result == 20 then local resultTrue = true print(resultTrue) else local resultFalse = false print(resultFalse) end end Incendia(15, 2) Incendia(20, 0) Incendia(12, 8) Incendia(18, 2) Incendia(12, 20)
Operators - Roblox Beginners Scripting Tutorial #10 (2024)
13:14
Loops - Roblox Beginners Scripting Tutorial #11 (2024)
17:41
BrawlDev
Рет қаралды 49 М.
Support each other🤝
00:31
ISSEI / いっせい
Рет қаралды 81 МЛН
Can 5 Devs make a STORY GAME in 24 HOURS?
19:55
CodeBro29
Рет қаралды 116 М.
I spent 1000 DAYS Building My Roblox Game!
12:23
DeHapy
Рет қаралды 242 М.
How I Mastered GODOT In Only a WEEK!
7:08
Simplicity
Рет қаралды 11 М.
I Made ROBLOX's Hardest Game.
16:06
Feodoric
Рет қаралды 256 М.
How Unoptimized Can a Roblox Game Get?
16:49
ByteBlox
Рет қаралды 322 М.
Classic Roblox Games: How Are They Doing?
17:09
Chappy
Рет қаралды 460 М.
The ACTUAL Impossible Obbies of Roblox
21:35
pczm
Рет қаралды 32 М.
I made a horror game that's IMPOSSIBLE to SCREENSHOT!
3:52
Branta Games
Рет қаралды 1,8 МЛН