Buzzy

Loading...

Buzzy

Register

Roblox Studio Tutorials - August 7, 2021

How to Make an Elevator Using Tweenservice on Roblox Studio

1

Buzzy Beth

@buzzygamesbeth

  • today we’re going to do another way that you can make an elevator in roblox studio this time using the tweenservice
  • so i’m in roblox studio i’ve already made a part and attached a script to it
  • i’m going to go into that script and first i’m going to get the tween service this allows us to use the tweenfunctions that we will need to tween our part
  • then we’re going to get a reference to the part by doing scriptdot parent and then we’re going to get two vector threes named start position and end position. this is going to be where our part stops and ends- feel free to change these values as you see fit
  • so we’re going to make a vector3 dot new parentheses and my part is going to go from 0 0 negative 20 where it is positioned currently in space i’m going to copy this and it’s going to go all the way up to 10 and then but right before we get our tween info done we’re going to set our parts position to the start position
  • now that’s all done we’re going to make a new variable and we’re going to call it tweeninfo so tween info is what we use to tween in roblox studio going in between different states or positions or you can do a whole bunch of things between
  • this is just one of the many things so all these numbers that i’m about to type mean different things. This first number 10 is going to be how long you want your tween to take so it’s going to be 10 seconds moving at one stud a second
  • next we’re going to do enum dot easing style dot linear so this makes our tween happen in a linear easing style this makes it really even all acrossand then we’re going to do another enumeasing directionso now we’re going to say uh how which way is it going to ease you can either do in-out or out we’re going to do in-out which means both in and out
  • then this is how many times you want the tween to repeat. Anything less than zero will be forever and that’s what we want
  • if we want to reverse after it is done which we do and then we’re going to have a five second delay between each tween
  • now we have our tween info we’re gonna have to make the actual tween now so we’re going to go do tween servicecolon create so now we are creating the tween using the tween info
  • we are tweening the partwe insert our tween info
  • then we’re going we’re going to do positionequals n position so that’s where it’sgoing to tween two so we have the property here for it between and then we have the end position which is where that property needs to be equal to and
  • then we play it simple as that and then once you hit play you can see that our part moves up and very soon it will be moving down