Advanced Roblox Scripting Tutorial #18 - Math Functions (Beginner to Pro 2019)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
alright guys welcome back to a brand new video and in today's video I'm gonna be teaching you a bounce um math functions yeah okay everyone's favorite math honestly I'm actually I should kind of like math but um most people don't but honestly guys math isn't that bad like it when you when you learn it it's not gonna be a bad teachers I don't know but do get used to it alright the functions I'm teaching you today aren't the most advanced ones are pretty simple ones but stuff you need to know for sure so I definitely teach you it okay so first things first we're gonna the video make sure to leave a like if you enjoyed and subscribe if you want more scripted tutorials also use code tap okay I'm a youtuber I've code tap alright when you're buying robux use code tap alright cool um anyways so I have a list of functions right here I'm gonna go through and yeah we good okay so first things first we're gonna do math dots floor okay so we're gonna do math that floor okay so whenever you do a math function first things first you do math and then dot the function okay or sometimes it's a it's a it's about you we'll go over that too but the first one I'm teaching you is math dot four okay so we're gonna go ahead and do math dot floor okay and what math dot floor it is it says it returns to the largest integer smaller than or equal to X now basically what it means is it rounds the number okay so this is very useful if you want to round a number down so if we'll say you have the number one point or a little B five six point there you go okay it's not a pretty number if you wanted to like tell your like tell someone that that they have this much XP or something like that it really don't want to see that right so what you would do is you'd round it down or round it up so you can go ahead and do math now floor and that's gonna put it down - obviously six now I guess I'll go ahead and run it cuz why not we're gonna print it out and then hit run and then here we go it prints six okay now there's one there's another function called math dot seal now if you see here it says math dot floor okay so that's math doubtful and then this is math dot seal now it's pretty easy I remember sealing it up floors down okay so floor is gonna round down absolutely gonna round up all right so that makes sense right so now we go ahead and you have six point we've the same number with math Osseo but meant that seal automatically rounds up instead of down so yeah okay next we have math dot huge okay now what is math that huge this is actually a pretty important when you place a lot now I thought you just in a function it's actually just a value okay so we're gonna print math dot huge and I actually have never printed it before it's might break my game I'm not sure um I don't think it will but it's gonna print like an SC in you see what it says this is int okay basically math dot huge is the largest number ever it's bigger than the number that you think is large it's bigger than that one okay it's just an infinite number basically so if you want to do something like and get the infinite number of it use math dot huge you don't have to type you know you don't fit site before that number okay you don't get span or a keyboard like that even though might be more fun and I thought if you just how you do it so yeah so I'll put math got huge largest number okay next we have math dot random so I've already listened I already talked to this before but math dot random is how you pick a random number so you do math dot random and then you pick a number or you get two values or two numbers to pick from so we'll do between one and ten and then what its gonna do is it's gonna print a number a whole number between one and ten so let's go ahead and hit the print button there we go run eight all right so we have eight but as you can see they're all so you can't do it backwards do not do ten to one it's gonna break your game I mean it's gonna break the script because it doesn't like that so make sure you do the least value first than the greater value second yeah so math dot random is that function right off okay and then we're gonna do math dot rat now what does matter at all it's a pretty rad function oh okay I'm gonna stop all right Matt that rat basically it what it does is it it gives you it returns the radians okay and it may new enter degrees okay so for example it's useful whatever you're like making things like like see frame because when you actually enter a see frame like you do see frame dot angles as you can see here it actually says wait look it says number dot R X that means radiant X okay so what you would do is you would just do math dot rad and then the put the degrees and that way you don't have to actually do the math and then it'll just do it for you right there so you let's say you want a ninety degrees and then you want math out rad fifty degrees you know I'm saying whatever you want but that's that's what it is alright I hope that makes sense okay so um you have that okay and someone's talking in the background so I figured here that um anyways so basically that's Matt that's Matt that rat okay there you go and next you have something called math dot degrees which is the other thing and it's math nun degrees basically what it does is it turns radians into degrees so it's just the opposite of math dot rad okay so we'll actually let's do math dot degrees okay and then we're gonna we're gonna put in ninety okay so we're gonna do ninety degrees and it's gonna turn it into radians if you guys don't know what radians our pleasure explain that routines are like another type of way to measure an angle I didn't even print it I'm dumb sorry about that let's go ahead and print it out okay and as you can see here eight prints 5156 yeah I don't know man radians basically what they are is they're just like it's it's a unit of angle that's what Google says okay and to wait it's the SI way of measuring angles in the standard unit of angular measurement in many years of mathematics so yeah one Radian is on is under fifty seven point three degrees so basically that's what it equals so you can do the math but this function will do it for you and yeah so when you're doing C you frame yourself it takes radians so what you just do is you use the math out Radium function and it'll just turn it into degrees for you still the math so yeah that's pretty cool so next we have math dot PI now if you guys know what PI is you probably do PI it's like 3.14 whatever the rest of numbers are it's an infinite number basically and it should it's just pi everyone knows what pi is right and you may have learned it in math class we haven't learned already but yeah it's just it's just a number that goes on forever and it's a good it's a really popular number basically yeah okay next we have math dot pal all right so math I'm just answered power but basically what it does is it takes your like math right so okay we'll do math dot pal and then it takes the first number and then it puts the the second number to the power of it so for example let's do five and then comma two and then it's gonna do basically it's gonna do five and then like you know how you put that little two like like like this let's imagine that Tuzla up there right like somebody has a little two up there that's what your student basically it's doing five to the power of two okay so it's gonna do five times five and then if it minutes of three it'll do five times five times five and there's a for it will do 5 times 5 times 5 times 5 so that's 4 times you know I'm saying basically it's gonna multiply it as many times as this number is so if we do 5 to the power of 2 its MD 5 times 5 and 5 times times you can already guess it's 25 so yeah that's what that is okay so that's math pal next we have the last function I'm pretty sure and that's gonna be math dot ABS now um you might learn some math classes well math dot abs basically what it is everything they would have put it it gives you okay I'm gonna use the function first okay so we're gonna do math abs and then we're gonna put a number in here we'll do 50 okay I'm gonna put that out basically it's good it's gonna print 50 okay math not abs is it gives you the absolute value of a number now what is the absolute value and you may have learned it in your math class in here if your math teacher told you that it's the positive number and she's wrong okay or he's wrong whatever gender they are it is the positive number it will turn any number you put in there positive but the reason why is because it gets a number okay so for example I'll put in negative 50 and you'll see what it will print out it's gonna print out 50 okay so it prints out 50 right and then what it is what it's doing is a math dot absolute value is it gives you the distance from zero so the distance from zero of negative 50 is 50 so that's why I gives you 50 okay it does give you the positive version of the number that's just kind of what it does but that's not why it does that if that makes any sense so yeah that's what math the absolute value does this is kind of useful you wanted her number to positive but other than that you might not use it um but yeah absolute value if you ever seen like in math class where you have those little pipes like you have look you have like you know like that you've seen that before right you do like X minus that equals equals that that's that's absolute value right there that's what it is right so yeah all right that's pretty much it guys um this was a pretty quick tutorial shorter than my other ones which is nice um that's pretty much it I hope you enjoyed it guys that is math functions use code tab Woodbine grow book super premium and leave like if you did enjoy guys seriously I'm try to make more videos more defconn videos and you guys supporting them it makes me want to upload more okay so I appreciate you guys leaving likes and subscribing and doing whatever and even watching the video seriously I make these videos because you got to watch them seriously I do so yeah I do appreciate you guys seriously but um anyways guys at the end of the video I hope you did enjoy it and if you did leave a like subscribe and us go tap alright peace
Info
Channel: TheDevKing
Views: 28,141
Rating: undefined out of 5
Keywords: TheDevKing, Roblox Scripting Tutorial, roblox, studio, coding, tutorial, robox math functions, math functions in roblox, lua math functions, how to script on roblox, roblox advanced scripting tutorial, math.floor roblox, math.ceil roblox, math.random roblox, roblox studio, how to round numbers in roblox, how to square numbers in roblox, how to get random numbers in roblox studio, roblox studio tutorial, how to script on roblox 2019
Id: seDPjYY4Gsw
Channel Id: undefined
Length: 10min 4sec (604 seconds)
Published: Thu Dec 05 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.