Advanced Roblox Scripting Tutorial #10 - TweenService / Tween (Beginner to Pro 2019)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right guys it is defconn here back with a bread tutorial and now I know it's been absolutely a long time it's been ages since I last uploaded and I apologize I'm gonna go ahead and explain why I said basically I went on vacation and then I came back and then I was just kind of getting back in the routine of things I apologize for lack of uploads I really should have recorded before I left but I don't know I just forgot I guess I'm sorry guys but there would be no more breaks like that anymore you guys know me I won't leave you again okay but yeah anyways let's go and get into the video and I'm gonna go to explain when I meet what I'm going to be teaching you about to date alright guys so you probably you probably clicked on this video and you were like okay tween service all right so what is tweening if you don't know what tweening is I'm gonna show you a quick example of what it is and then I'm gonna explain to you how to do it and all that good stuff alright so let's go ahead and start toriel and we start the game and i'll show you what it means so look at this part right here as the game run so just keep your eyes on the part okay so I put a weight on it to wait a few seconds there you go boom look it's growing okay you got like super big and then it's streaking back down okay so that's what tweening is now basically what it does is it changes the properties of a part or even like a GUI which is like the things on your screen right it'll change the properties of a part or GUI or whatever like the size or the transparency or the position if you want to move it around right but it does it like slowly and in a way that you know like doesn't look like it just teleports okay so it's not like you just set something it actually does it slowly and you can determine you can specify how long you want it to last or whatever right so I'm reaching about that today anyways I'm gonna go ahead and move the script to my server storage so and I'm gonna disable it so don't worry about that that's just later for reference and yeah anyway so first things first you want to go ahead and insert a part into your workspace okay so this is the part we will be tweeting okay we're gonna be making all the changes to this guy right here and it will leave a name part but then we're gonna go in and insert a script into it so go ahead an insert a script and then there we go now look at the script into it we want to first of all get tween service okay now how you make tweens is you have to have tween service in your script okay so we have to define tween service alright so local tween service equals game get service tween service there we go and now we're going to define the part which is the script dot parent and let me zoom out a little bit looks a little too big there we go and then we're going to actually like specify the tween so how you do this is you do local or not specified it's weanling we're going to make it so like how long we want between the last and basically the style of the tween and stuff like that so I'll turn that here a second but we're first things first we're gonna go ahead and do local info equals tween info dot new and then here we go okay before we type the second parenthesis look at this right here okay I'm not sure you can see it's probably really small you can't really see it but it says tween info dot or sweet info new number time and then the easing style easing direction that amount of times you want to repeat it if it reverses and then the delay so basically you could type all that stuff right here in one line like level blah blah blah blah blah blah right but what we want to do is actually put it like this okay so it's easier to read all right now basically those are all parameters for tween and I'm gonna go through each and every one of them and explain what it does so if that was a little confusing I'm sorry but we're gonna put that up right now alright so the first parameter for tween info is the link so how long you want between the last I'll say maybe five seconds okay that sounds about a good time what we want to do is make our part bigger okay that's the goal for this tween so we'll just make it last five seconds and to keep it simple I'm going to actually put a comment here and that way if you forget what the what the parameter does noise see over here okay a second parameter is the easing style now also one thing make sure you guys put a comma there or else you're getting a little air right here so make sure you put a comma after each parameter so yeah anyway so we're gonna do in amazing style and then dot and then here all using styles now you're probably wondering okay what is an easing style and what do these look like so an easing style is basically the way it you want it to tween do you want it to tween like in a certain I don't explain it okay I'm gonna show you like what the robots what he says so here's all the easing styles that I have okay or all that are available these are all easing styles and basically the way they work now as you can see here you have elastic which basically goes out into your place and then it bounces out a little bit right and then it comes back okay so that's what that's what it is alright and then linear obviously goes one way just very right at the same speed sign you see it goes all the way over and then it slows down toward the end and then all of these you know have different variations but for this purpose we're gonna be using sign just because it looks really smooth and nice I like it a lot so also guys if you're if you want to see this later on I like all the easing styles I'm gonna leave a link to a description below so you can check it out later for yourself okay anyways now that we have that go ahead and type in I'm not using style dot sign that's one we'll be using its it's that one that looks pretty smooth right but it slows down toward in I like it a lot it looks it looks nice anyways let's go ahead and do that all right so that's the easing style okay so I'll just write easing style right here one second alright alright using style okay and then we want to do the easing direction so which direction do you want it to do it and we're gonna put easing direction or even about easing direction dot out okay so that's the way it does there also is in and then there's in out so I don't really don't explain that too well but basically an is like in and then out is like out and then it now it's like both I guess right okay anyways so then I'll forgot to put the comments see I'm getting a little air right there I don't make sure I put my commas okay and then let me do this okay easing direction okay that's what that is and then we're going to do the amount of times we want it to repeat okay so we want to make it big right but do we want it to repeat it and do it again or do we want to do it just one time for this we'll just do it one time okay so we're gonna do zero we don't want it to repeat any times you may think oh you want to do like one because you want it to do it once but no this is like repeat so how many times you want to do it again so it's gonna do it one time if you said it zero and then obviously if you said it the two it's gonna only do it or it's gonna do it three times if you said it's a 1 it's gonna do it two times so yeah hold it makes it make sense so just set it to zero and then it'll only do it once and then I'm gonna put a comment here that amount of times it repeats that way you know okay and then obviously you guys if you don't know these are just comments okay they're optional you don't have to read these counselor here these just these are just reminding you what these do okay you don't have to write this part so yeah okay next is the reverse so do you want it to reverse whenever it tweens so whenever you make it super big do you want it to go back down or not so for us we'll just do no I don't want it to reverse but then we can always change it later all right so that's the reverse so false we do not want it to and then the last parameter is delay so do you want it to delay so do you want to wait three seconds where does it or what honestly I'm not gonna put a delay here um but yeah yeah okay anyways all right so that's all the parameters for tween okay that's how you to make a tween or make new tween info okay so next we want to actually specify wait I'm getting an error right here with that I don't know what from but oh yeah I put it I put a comma right here don't put a comma at the end guys I actually put a comma at the end for after zero but there's no more parameter so you don't need to put that okay so next things next we need to actually specify where we wanted to go okay so what we're gonna do is make a table called goals all right now this is you can name it whatever you want goals can be named you know like ending info right or whatever you want to call it but we're gonna call it goals just for what do we want it to be at the end what's the end goal right so we're gonna make a table and we're gonna write like that that's how you make a table right but what we're gonna do is put a space here so it looks a little bit nicer okay and we can also put this down there too so it's easier to read okay anyways now let me have that what do we want to do okay so we want to make it bigger right so we're gonna do size equals vector three because size three value dot new and then we're going to do fifteen by fifteen by fifteen and then put a semicolon at the end so the semicolon is what using tables and then commas are what use in functions now if you want to be on the perimeter sort of like like for example if you want to tween the transparency of the part you know you gotta make sure I spelt that wrong prints pair and see there we go you want to make sure let you put that in there and then we're gonna make it point five I guess right we can make it by 0.5 and then put it but it's not going all right now obviously guys you don't have to put transparency we don't want to I'm actually deleted that was an example but one quick thing before I end this goals part right here right goals um whenever you type size here or transparency right or brick color right or any property of a part or position right you need to make sure you spell it right if you spell it wrong so if I do position equals vector three new 15-15-15 right or whatever you want everyone all right if I do position I spell it wrong with two eyes it the scripts gonna break he doesn't know what to do because what it does whenever it makes it tween is it gets the part right so it gets the part and then it sees the goals so it does part dot size and obviously as you can see here size was the capital S so it is part of size and it changes it to that right but if you put a lowercase s like that size it's gonna give me an error okay so make sure you have the capitalization exact on the goals even though it won't give you an error on the script once you actually run it in the output it will give you an error okay so yeah anyways make sure it's capitalized and make sure it's word for letter for letter and capitalization is correct like from your properties okay so yeah anyways I'm gonna delete all that part because we only want sighs alright so we're almost on between now all we have to do is actually create a tween so this is we're gonna call this tween make part bigger tween okay this is what it this is what the team does okay it makes a part bigger okay so then we're going to do tween service or local make part bigger tween equals tween service creates part info or not part info and then goals okay now let me go through this real quick if you're a little confused you can name it whatever you want this is just a variable of what you want to call the tween so really we could just name it tween if you wanted to but we don't anymore I want to be more specific and what it does it makes a part bigger so that's what we'll call it and we're gonna put a lowercase M because it looks nicer so yeah anyways and then you do equals tween service and then you're creating a tween and you're using the first parameter which is the part what do you want a tween well that's our part and then what how do we want to do it so what info do we need right so we need to know how like how long that needs to be the easing style the easing direction the times repeated or reverse delay etc right and then we need to have what is the end goal okay what do we want it to do at the end and that's here that's our goals okay so that makes sense to you guys and now actually if you want ascribes it won't work what you need to do now is to actually play the tween so now we need to do make part bigger tween play okay so : play and then with the function write : play and then parenthesis alright so that's how you do it easy is that I'm actually gonna run the script now and then we can start it so actually before I actually run the script I'm going to put a weight right here so I'm gonna put wait one second because I don't want the game to load faster than we load and then we can't see the tween so I'm gonna put weight one right there so we can wait for the tween to load in it and so we can load in but yeah anyways now we can run the script see if it works so here we go run and oh look at that guys our part is growing that's so cool so basically like I said guys it basically does what you want it to but not instantly it doesn't integrate in a slower manner right and however you long you want it to be it will be so like for example if I want to do it in one second right if I wanted to tweenie want to take it long boom it grew super fast now before was five seconds so that's why I grew super slow but obviously this means that however you want - and then also we can change anything we want like let's say we want to do different easing style okay let's try elastic and boom see it bounces a little bit it's a little weird right but that's how elastic works like I said I like sign it looks so it looks the cleanest in my opinion but you know for different games you want different stuff so you don't we can change it and then reverse if you change that to true what it's gonna do is actually it's gonna do tween right but then it's gonna move it back so watch this ready it grows it grows and grows and grows and grows and then it goes back okay so it does the same tween but it reverses it so yeah there you go and then delay obviously it's how long you wanted to wait for the screen runs and then times if you did let's say 1 or let's say you want to run it twice right so or tries to actually run three times because you're repeating it twice but now we're going to repeat it two times and as you can see here it grows and then it goes back and then it grows right and then it goes back and as you can see it repeats twice and then also let me change this to one second because it's really long but now I'm going to actually set the reverse to false right so I'm gonna set the reverse to false but I'm gonna make it repeat and you're probably wondering okay so how's it gonna repeat if it's false so what's gonna happen is it's actually just gonna it's gonna grow super big and then it was those teleport back now it's bouncing because it's clipping through the mesh that's why so yeah but yeah so yeah that's why it's bouncing but a neural I normally wouldn't if you just put it higher near and and then you anchor like that so look as you can see here it's gonna grow and then it's gonna it's gonna teleport back now the reason why I teleports is because I don't have it set to reverse so when it wants to repeat it has to go back to this original state so yeah anyways guys that's pretty much training and how it works I hope that made sense to all you if you have any questions like always guys be sure to run or least sure to join this course server leave a comment in the comment section below or ask in the discord server people in their all time or helping you so yeah anyways guys make sure to subscribe if you're new that way you don't miss out on any new script new tutorials and also have a playlist the beginner series if you're still confused and you don't know anything about scripting at all you might want to watch the beginner series for or you know the start of the advanced series so anyways it has that's pretty much it hope you enjoyed then I'll see you in the next one peace
Info
Channel: TheDevKing
Views: 78,979
Rating: undefined out of 5
Keywords: TheDevKing, Roblox Scripting Tutorial, roblox, studio, tutorial, advanced roblox scripting tutorial, how to script on roblox, roblox tween service, how to use roblox tween service, roblox tween service tutorial, roblox tweenservice, roblox tweenservice cframe, roblox tweening, how to tween on roblox, tweening roblox, part tweening roblox, tweening parts roblox, what is a tween animation, roblox tweening explained, how to tween parts in roblox, tween tutorial roblox, roblox studio
Id: pKbQbCf9i90
Channel Id: undefined
Length: 15min 41sec (941 seconds)
Published: Sat Sep 28 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.