[NEW]How to make A Pet Simulator X Game on Roblox - Part 2 — Transcript
Full transcript
- 0:00hi everyone and welcome back to the
- 0:02updated pet X St game series in this
- 0:05video I'm going to be showing you how to
- 0:06make this simple egg hatching system as
- 0:09well as shown you how to make this door
- 0:12opening
- 0:14system also if you guys want to support
- 0:16me and want to have access to all of my
- 0:18project files including the one you're
- 0:20watching right now they will all be
- 0:22available on my patreon in$ tier the
- 0:25link will be in the description with
- 0:26that being said let's start all right so
- 0:30so the first thing we're going to do is
- 0:31work on the ounting system now we're
- 0:33going to need a uh egg an egg mesh for
- 0:36this so I have this mesh part right here
- 0:38that's an egg and I renamed it to basic
- 0:42egg and what I'm going to do is inside
- 0:44of that basic egg I'm going to add a
- 0:45proximity prompt now I'm going to set
- 0:47the action text to open and the requires
- 0:51line of site property to false and then
- 0:54the uh hold duration to
- 0:560.4 and then I'm going to add a modu
- 0:59script do this which I'm which I'm going
- 1:01to rename to
- 1:03data and inside of that this data module
- 1:05I'm going to have a return and we're
- 1:08going to return the egg price so we're
- 1:10going to store the egg price which will
- 1:11be 10 and then the egg
- 1:13currency which will be maybe coins you
- 1:16can have it as Gems or any currency you
- 1:19have and then we're going to need the
- 1:21egg pets so egg
- 1:24pets curly brackets again and the first
- 1:27betet is going to be a uh okay so a
- 1:31table again and it's going to be called
- 1:33so pet name will be
- 1:35cat and the chance of getting one will
- 1:39be 100% so 100 and I forgot to add the
- 1:44comma right here and then the Rarity
- 1:46which will be so Rarity uh
- 1:51common and if you want to add the second
- 1:53pet just copy this baste it here and
- 1:55change this to two instead of one and
- 1:58this time also make sure to have a comma
- 2:00right here and it will be maybe Fox and
- 2:03the Rarity will be
- 2:0550% now make sure that both of these
- 2:09percentages add up to 100% so now this
- 2:12is not right so I'm going to have this
- 2:13one as maybe 70% and the other one is
- 2:1830% just make sure that that they add up
- 2:21to 100 and maybe this can be
- 2:23uncommon but for now I'm only going to
- 2:25have the cat so just cat
- 2:30and what I'm going to do now is add a
- 2:33folder inside of the main folder _
- 2:35workspace and it's going to be called
- 2:37eggs and I'm going to have this basic
- 2:39egg mesh inside of this and what I'm
- 2:42going to do
- 2:44is go to starter
- 2:46player starter player scripts and I'm
- 2:49going to add a local script and it's
- 2:50going to be um egg
- 2:54client now in this module script we're
- 2:57gonna I mean in this script sorry we're
- 3:00going to script the uh X system on from
- 3:03the client so what I'm going to do is
- 3:05local run service we're going to start
- 3:07with some services so run service is
- 3:10equal to
- 3:11game uh game call a service run service
- 3:15and then we're going to get replicated
- 3:17storage replicated storage is equal to
- 3:20game call get service replicated storage
- 3:22then we need local players it's get
- 3:25service players then we need tween
- 3:28service local twn
- 3:30service this equal to game call get
- 3:33service TW
- 3:34service and then we're going to
- 3:37need
- 3:39um a reference to RX so
- 3:42local X is equal to workspace for child
- 3:46main folder workspace for child egg and
- 3:50then we're going to need the remotes
- 3:51loal remotes is equal to eggs or
- 3:54replicator storage call for child
- 3:56remotes and then we need the pets so
- 3:59loal pets is equal to replicate and
- 4:00storage with child pets and then we're
- 4:03going to need the player so local player
- 4:06is equal to players local
- 4:09player and local okay so now we need
- 4:11some UI so what I'm going to do is exit
- 4:16out of the script and inste of our
- 4:17started GUI I'm going to add a screen
- 4:19GUI and it's going to be called um egg
- 4:25system and inside of that I'm going to
- 4:28have a uh
- 4:30viewport frame and I'm going to position
- 4:33it right here put it right here and I'm
- 4:37going to change its size to one 0.1
- 4:41comma 0 comma 0.1 comma 0 and then I can
- 4:44resize it because now it's converted to
- 4:46scale so I can just make it a square
- 4:49make it bigger put it somewhere around
- 4:52here and inside of that viewport frame
- 4:55I'm going to have also I'm going to call
- 4:57this egg viewport
- 5:01and inside of that we're going to have a
- 5:03text label and I'm also going to change
- 5:05it size to one comma 0 comma 0.1 comma
- 5:100 and I'm going to make it a bit bigger
- 5:12and I'm going to drag it down here and
- 5:15I'm going to duplicate it and put the
- 5:16other one
- 5:17here and I'm going to select both of
- 5:20them of my text labels and I'm going to
- 5:21change the background transparency to
- 5:23one the
- 5:25text color to maybe White and the font
- 5:28to for do
- 5:30one for do one and then I'm going to
- 5:34change the uh okay so the text will be
- 5:39nothing and inside of both of them we're
- 5:42going to add a UI
- 5:46stroke so I'm just going to make
- 5:50it um okay where is
- 5:52it I'm going to give them a text so
- 5:55maybe common or cat
- 6:01and I'm going to make this a bit smaller
- 6:03and then I'm going to make sure that t
- 6:05scal is checked
- 6:06sorry and I think this looks good now
- 6:09I'm going to do the same thing for the
- 6:10other one so select the UI stroke place
- 6:13it into this make sure that Tex scale is
- 6:16checked and what we also need to do is
- 6:20so the first one will be a name label so
- 6:22I'm going to call it name label and the
- 6:24second one is going to be called Rarity
- 6:26label
- 6:29okay so now the background transparency
- 6:31of the of the viewport frame will be one
- 6:34and then I'm going to make sure that the
- 6:36enabled property is set to false on the
- 6:39X system and what I'm going to do now is
- 6:41go back to my X client script and what
- 6:44I'm going to do is get local egg view
- 6:47portal or egg system SS is equal to
- 6:51player call with for child player gy
- 6:54call for child egg
- 6:58system and and local egg viewport is
- 7:02equal to egg system assass con for child
- 7:05egg
- 7:07viewport okay so what I'm going to do
- 7:09now is have a function called hatch egg
- 7:11so hatch egg and it's going to take the
- 7:15egg
- 7:15name and then the chosen pet so chosen
- 7:20pet and what I'm going to do is have a
- 7:22for Loop right here and what's this for
- 7:25going to do is just okay so I'm going to
- 7:29Loop through
- 7:30the through um
- 7:33player call Wa for child player gy call
- 7:38and get children or player dot okay so
- 7:41I'm going to do player do player gy call
- 7:45and get children and we're going to
- 7:46check if it's screen gy then uh we're
- 7:48going to check if V is not equal to our
- 7:50EX system gy and then we're going to
- 7:52disable it and then I'm going to Loop
- 7:57through the egg view port
- 7:59and we're going to check if there is a
- 8:01camera inside of it or if it or if there
- 8:03is a base part or a model then we're
- 8:05going to destroy it and then we will
- 8:08make the size of the x view Port so X
- 8:11viewport do size will be using to. from
- 8:16from scale and 0 comma
- 8:200 and then local egg
- 8:23mesh is equal to
- 8:25egg egg going find first child um egg
- 8:30name col
- 8:33clone and then we're going to parent it
- 8:36so egg mesh parent is equal to uh egg
- 8:42viewport and then egg mesh
- 8:46cframe is equal to CF frame. new 0 comma
- 8:500 comma 0 I'm just going to add some
- 8:53spaces right
- 8:54here and then local camera we're going
- 8:57to create a camera is equal to instance.
- 8:59new
- 9:01camera and Camera parent is equal to egg
- 9:07viewport and
- 9:10Camera cframe equal to cframe do new CF
- 9:13frame. new 0 comma 0 comma 0 comma 4 and
- 9:19then uh viewport current camera current
- 9:24camera is equal to to um camera
- 9:30and then I'm going to create tween so
- 9:33tween service call create uh what am I
- 9:36doing call create and X viewport comma
- 9:41TW
- 9:42info new uh maybe 0.7 seconds
- 9:470.7 comma and we're going to change the
- 9:49size to to do new and what I'm going to
- 9:54do is get the size of my egg viewport so
- 9:58just type in the size and copy it and
- 10:00then you can paste it right here and
- 10:02just get rid of the curly
- 10:08brackets and then we're going to add a
- 10:10colum play at the end and then after
- 10:14we're going to wait for this to so task
- 10:17we going wait for this TW to finish 0.7
- 10:20so we're going to wait 0.7 seconds and
- 10:23what we're going to do is for I is equal
- 10:26to from 1 to 4
- 10:31and what I'm going to do is Twin service
- 10:34on Create and x view Port comma TW info.
- 10:39new
- 10:400.3 comma en. style. sign comma en. e in
- 10:45direction eing direction
- 10:49out comma and I'm going to change the
- 10:53rotation so just rotate the egg we're
- 10:55going to set the rotation to 20 and we
- 10:58going to play this TW and then we're
- 11:00going to wait 0.3
- 11:03seconds and we're going to copy this
- 11:05tween right here and we're going to
- 11:06paste it in here but this time it's
- 11:07going to be minus
- 11:0920 and we're going to add another task.
- 11:12we
- 11:130.3 and after that is done well we will
- 11:18create a new twin so twin
- 11:20service we are pretty much just going to
- 11:24do the same thing just copy one of these
- 11:26twins put it here and change the
- 11:28rotation to zero this time and then
- 11:30we're going to wait t. wait 0.3
- 11:34seconds and what I'm going to do is
- 11:39just okay so I'm going to change to copy
- 11:41this twen right here of the viewport
- 11:43size paste it right here and we're going
- 11:45to change the size to 0a 0 comma 0 comma
- 11:500 and then what I'm going to do is wait
- 11:540.3 0.3 seconds also we can simplify
- 11:58this by doing medum to from scale and
- 12:01just put in 0 comma 0 that should be a
- 12:05bit better and then I'm going to Loop
- 12:09through the EG view Port going get
- 12:11children and we're going to check if
- 12:13there is a camera or base part or model
- 12:15then we're going to destroy it and then
- 12:17we'll get a pet model so look pet model
- 12:20is equal to and pets going find first
- 12:23child chosen pet do pet
- 12:27name pet name name col
- 12:31clone and pet model pet model call pivot
- 12:362 d frame. new 0 comma 0 Comm
- 12:400 0a 0
- 12:430 and then we're going to parent it pit
- 12:47model parent is equal to EG VI port and
- 12:51then I'm going to create the camera is
- 12:54equal to instance. new camera and Camera
- 12:59okay so camera parent is equal to X
- 13:02viewport and Camera C frame is equal to
- 13:05C frame. new and this time I'm going to
- 13:08do 0 comma 0 comma and maybe Min -
- 13:133.3 and we'll multiply that by C frame
- 13:17angles and 0 Comm math rad math rad uh
- 13:23180 so I'm going to rotate the camera
- 13:25because I don't think it will be facing
- 13:26the right way but if it isn't facing the
- 13:29right way for you then just to mess
- 13:30around with this maybe you can rot
- 13:32rotate at
- 13:33360° uh 180 90 but for me it's going to
- 13:36be
- 13:38180 because I've tried this before and
- 13:41then what I'm going to do is x view Port
- 13:44current camera current current
- 13:48camera is equal to camera but now what I
- 13:52just realized is that we have two camera
- 13:54V variables up here so what I'm going to
- 13:57do is change this to camera pet
- 14:02and now it should work sorry and then
- 14:06the next thing I'm going to do is create
- 14:08a tween so I'm going to Tween the EG
- 14:12viewports
- 14:13size actually I'm sorry just do the same
- 14:16thing that you did here just copy this
- 14:18one tween right here paste it in here We
- 14:20R the size and then I'm going to do egg
- 14:24viewport do name
- 14:27label Dot text is equal
- 14:31to and chosen pet. pet name and then a
- 14:37viewport do name
- 14:40label visible is equals
- 14:43true and then
- 14:47um we will just okay so egg viewport dot
- 14:53Rarity
- 14:54label. text is equal chosen pet. Rarity
- 15:01and that should
- 15:03work and then after that we're going to
- 15:06do egg view Port Rarity
- 15:12label visible is equal to
- 15:16true and the next thing is weight
- 15:200.5.1 or Point okay 1.5 seconds is
- 15:23better and tween service call on create
- 15:27so just copy this one tween right here
- 15:29PED in here where we TW where we are
- 15:31tning the size of this but this time I'm
- 15:34going to put in 0.3 because it will be
- 15:36better and then I'm going to wait 0.3
- 15:39seconds so
- 15:40task
- 15:42askask wait 0.3 seconds and I'm going to
- 15:47change both of these visible properties
- 15:50to
- 15:51false
- 15:53false and this to so false
- 15:59and then I'm going
- 16:00to Loop through these
- 16:04again and
- 16:06enable everything that's not the egg
- 16:08system as as one thing that I forgot to
- 16:10do is show you how to fix this one bug
- 16:13so when you are looping through okay so
- 16:15in the X client script in the line 68
- 16:19when we are looping through these
- 16:22through the screen gys make sure that
- 16:23you are doing player away for child
- 16:26player gy going get children not script.
- 16:30parent going get children or this will
- 16:32not
- 16:34work now what I'm going to do up here
- 16:38is
- 16:40just okay so after doing this what I'm
- 16:42going to do is just uh X system asss do
- 16:46enabled is equal to false to true sorry
- 16:50and also make sure that the name label
- 16:51and the Rarity labels on
- 16:54invisible and now what I'm going to do
- 16:57is
- 16:59okay so I'm going to create a new remote
- 17:02event inside of inside the remotes
- 17:05folder so just Pat I mean remotes remote
- 17:10event and I'm going to call it
- 17:13hatag and I'm going to add I'm going to
- 17:17add a
- 17:19uh script inside of the server script
- 17:22service I'm going to call it
- 17:25X
- 17:27server now what I'm going to do here is
- 17:30okay so just paste
- 17:32just put this in so we're just getting
- 17:36the remotes the replicated storage
- 17:38players uh remotes and
- 17:41X so it's the main folder where r space
- 17:45not main folder workspace and then I'm
- 17:48going
- 17:48to do a debound table so I'm going to
- 17:51make a debound table so player uh hatch
- 17:56debounce debounce and an mty table and
- 18:00we going to create a function for
- 18:01choosing a random pet so choose random
- 18:04pet and it's going to take a pet
- 18:08table and what I'm going to do is local
- 18:10chosen pet is equal to
- 18:13nil and local random
- 18:15number is equal to math random from 1 to
- 18:19100 and local
- 18:22weight is equal to
- 18:25zero and for i v in pairs per table do
- 18:31and weit plus equal V do
- 18:36chance and then if we is greater or
- 18:40equal to random number then uh chosen
- 18:45pet is equal to V and break we're going
- 18:48to break this and then I'm going to
- 18:51return the chosen pet now that we've
- 18:52just chose a random pad we will just set
- 18:55up all the X so for UND
- 18:59comma egg and detect the input too so
- 19:02for underscore comma egg impairs eggs
- 19:06get children
- 19:08do and what I'm going to do is egg
- 19:12proximity
- 19:13prompt do um okay so
- 19:18triggered P connect
- 19:22function and this is going to take the
- 19:25player and local egg data egg data is
- 19:28equal to to require egg.
- 19:31data and local price is equal to egg
- 19:36data price and loc or EG
- 19:42price and local currency is equal to and
- 19:46it's going to take the egg data do
- 19:49currency or egg currency I don't I don't
- 19:52remember what we called it I think it
- 19:53was currency cuz it was egg
- 19:57currency all right so then we're going
- 19:59to check if player the leader stats
- 20:03square brackets
- 20:05currency is the value is greater or
- 20:11equal uh what am I doing greater or
- 20:13equal than the price if it's bigger or
- 20:16equal to the price then we going to do
- 20:19so we're going to check if not de
- 20:23balances uh square brackets player then
- 20:29then player hashd
- 20:32bounce uh square brackets player is
- 20:35equal oh play is equal to
- 20:39true and local chosen pet is equal to uh
- 20:44choose random pet we're going to call
- 20:45the function it's going to take the egg
- 20:47data data do egg pets I think egg pets
- 20:54yes and
- 20:56then player. readers tat
- 20:59expore brackets currency value minus
- 21:01equal the price and then we're going to
- 21:03fire the remote event so remotes hat
- 21:07fire client player comma name comma
- 21:09chosen pet and then I'm going to create
- 21:11a value so a value is equal to instance.
- 21:15new um string value and val. name is
- 21:19equal to uh chosen pet do name and I
- 21:25mean do pet name and and val. parent is
- 21:31equal to player.
- 21:34[Music]
- 21:36pets now I'm going to wait seven or six
- 21:41seconds and what I'm going to do is ler
- 21:44hatch D bounce squ back as player is
- 21:46equal to nil my defaults now what I'm
- 21:51going to do is players player remove any
- 21:53connect function and we're going to
- 21:55check if player hat debounce uh brackets
- 21:59player then player hasd bound square
- 22:01brackets player is equal to nil now I'm
- 22:03going to play this and see if anything
- 22:05works okay so we have main folder okay
- 22:08so I messed up in
- 22:10here it's main folder _ workspace so
- 22:15main folder _ workspace not main folder
- 22:20workspace and let's see if this is going
- 22:22to work no errors yet I'm going to try
- 22:25to patch this and we get a okay so we
- 22:29get in thereor and it says attempt to
- 22:33compare
- 22:34nail okay okay I think it's because we
- 22:39don't have any leader stats
- 22:41yet leader stats
- 22:43coins okay so we do have coins oh and I
- 22:47also forgot to add a folder in here
- 22:49called uh
- 22:52pets now I
- 22:54think let's see what's wrong with this
- 22:56currency is coins
- 23:01so attempt to
- 23:04compare
- 23:07nail okay maybe if we do do coins let's
- 23:11see if this is going to
- 23:21work okay so this is also not working so
- 23:23what I'm going to
- 23:24do is go ahead and try to find a fix
- 23:28this and I'll be
- 23:30back okay I found an easy fix for this
- 23:32all it was is that the price is X price
- 23:36with a capital E not a lowercase e so
- 23:41now it should
- 23:43work I'm want to go ahead try this
- 23:46out and see what errors we get now
- 23:50server script service attempts index
- 23:52with name
- 24:00okay so what you're going to do is
- 24:01change val. name to two string chosen
- 24:04pet. pet name make sure to add the two
- 24:05string and also go to the X client and
- 24:09what we're going to do is just put in uh
- 24:12remote com child hatch EG don't Cent
- 24:15vent con connect hatch egg and that
- 24:17should
- 24:20work and let's test this
- 24:24out so as you can see it does open the
- 24:27egg
- 24:29and it does that but as you can see it
- 24:30does that weird animation and it's very
- 24:32simple to fix all we got to do is
- 24:35just enable this make this
- 24:39visible I'm going to change the
- 24:40background trans to zero and I'm going
- 24:42to change the Anchor Point to
- 24:440.5 and the position to 0.5 comma
- 24:490 comma 0.5 comma
- 24:520 and maybe put it up a
- 24:55bit okay that's good enough now we can
- 24:58change the transparency back to one
- 25:02visible true enabled false and now if
- 25:07you play the game that should look a lot
- 25:09better so just play this and I'm going
- 25:13to go there open this up and as you can
- 25:17see it twns it does everything smoothly
- 25:21and I think this looks good now what I'm
- 25:23going to do
- 25:25is go ahead and make a door so so a door
- 25:28that you can
- 25:30unlock so I have made a
- 25:36door and I'm going to make this to a
- 25:38model and give it to you the link will
- 25:41be in the description and what you're
- 25:43going to do
- 25:44is okay I'm I'm going to see if I can
- 25:46export this right
- 25:51now okay so I just did that now we have
- 25:54a door and basically what's inside of
- 25:56this is an in value that's the price
- 25:58proximity prompt and a surface gy that
- 26:01displays the price uh of the door now
- 26:04what I'm going to do
- 26:06is just show you how to code the
- 26:10door so what I'm going to do is okay so
- 26:15I'm going to think about this I'm going
- 26:17to add a remote right
- 26:20here a remote which I'm going to make it
- 26:23a remote
- 26:25function and it's going to be called
- 26:27purchase door
- 26:29and we're going to have two different
- 26:31remote events and one of them is going
- 26:33to be called prompt purchase door and
- 26:36the other one is okay so just one I'm
- 26:38sorry I copied something else so add
- 26:41another one prompt purchase
- 26:44door and we're going to enter the main
- 26:46servers undor script and we're going to
- 26:48paste this in so foror commor impairs
- 26:51workspace domain folder main folder bace
- 26:55door going to get children and door.
- 26:59proximity parts. proximity prompt.
- 27:01trigger connect function and when this
- 27:03is triggered then we're going to just
- 27:05check if player if the player does not
- 27:06own the area first and then we're going
- 27:09to fire the remote event so that should
- 27:12work now what I'm going to do is just
- 27:15add a folder inside of the player data
- 27:17it's going to be called
- 27:19doors or maybe
- 27:22areas and I'm also going to add a folder
- 27:26inside of the workspace I'm going to
- 27:28call it
- 27:32doors and put the area underscore one
- 27:35inside the door the doors and this is
- 27:39basically the first door you can
- 27:41position it wherever you want make it
- 27:43bigger
- 27:44maybe and okay so I have that now what
- 27:48I'm going to do is enter a client script
- 27:51okay so inste of here you're going to
- 27:52put this in so just put this in now copy
- 27:56this I know it doesn't make much sense
- 27:58right now okay so we we are just getting
- 28:01replicated storage the player and the
- 28:04remotes but this doesn't make any sense
- 28:06so the main SS we don't have that yet
- 28:08but I'm going to show you how to make
- 28:10that now that that will be in the
- 28:12description it's a model of the UI we're
- 28:14going to be using I'm going to okay I'm
- 28:17going to go ahead and drag it
- 28:19into the starter gy and it's basically
- 28:24this it just has this would you like to
- 28:29purchase this area for 1.5k coins and
- 28:32this is all it
- 28:33has yeah and you can put this inside of
- 28:37gy and make sure that it's not visible
- 28:42I'm going to go back to my main client
- 28:43script and I'm going to change this to
- 28:46instead of script. parent going I do
- 28:48player going wa for child
- 28:51player guy call if your child domain SS
- 28:56and then the door purchase you and this
- 28:58is just the connection that we're going
- 28:59to be using later now what I'm going to
- 29:01do is
- 29:03remote do prompt purchase door client
- 29:07event connect function door and what I'm
- 29:10going to do is door purchase ui. visible
- 29:12is equal to
- 29:13true and then your purchase
- 29:18UI purchase text purchase
- 29:21text. text is equal to and would you
- 29:26like to purchase this area
- 29:30purchase
- 29:31purchase this area for uh space do Dot
- 29:36Door do price. value do Dot
- 29:40and face
- 29:43coins and then area button area button
- 29:47connection is equal to and door purchase
- 29:50UI
- 29:54buy Mouse button Mouse button one
- 29:59click one connect
- 30:03function and just put this in okay so
- 30:06loal remotes local results sorry is
- 30:08equal to remotes purchas door invoke
- 30:11server and what I'm going to do is if
- 30:13results is equal go true then door Go
- 30:15destroy so we are pretty much just going
- 30:18to destroy the door so that the player
- 30:19can go through it now and then
- 30:22area purchase button connection colon
- 30:26disconnect and after that door PR UI
- 30:30visible is equal to false now what if
- 30:32the player presses the no button close
- 30:36button uh what I'm going to do is close
- 30:38it so just do door Pur
- 30:42UI do close
- 30:45Mouse Buton one
- 30:50click on connect
- 30:53function and what I'm going to do is
- 30:55just okay so door Pur you y
- 30:58visible is equal to
- 31:01false now I'm going to test this out so
- 31:05I should be
- 31:08able to have an interact proxim prom
- 31:13right here and when I press it it should
- 31:14prompt this and I can close it and open
- 31:16it again but the buy button shouldn't
- 31:18work yet because we haven't scripted the
- 31:20server yet so I'm going to enter the
- 31:22main service script and what I'm going
- 31:25to do inside of
- 31:26here is is okay
- 31:30so game replicat
- 31:33storage so game replicator storage.
- 31:38remote purchase door door on server invo
- 31:40equal to function for Comm a door and
- 31:43want to get the actual door from the
- 31:45server to make sure that the door
- 31:47actually exists and then want to check
- 31:49if it is a thing so if it is a thing
- 31:52then we're going to check if the
- 31:54player's coins value is greater call
- 31:58then the server door. price. value then
- 32:01I'm going to make sure that the player
- 32:02does not own the door and then we will
- 32:06subtract the price from the players
- 32:08coins and then we're going to create a
- 32:11door value so this door value will be
- 32:13pretty much like the Val that we created
- 32:15like value that we created for
- 32:17DX and then we're going to return
- 32:23true three and lse
- 32:29return
- 32:32fults now I'm going to play this now and
- 32:36it should work so I should be able to
- 32:39purchase it but I don't think I have
- 32:42enough coins okay so it's 1,000 coins so
- 32:44I can buy it and it should throw an
- 32:46error and it says main fold L okay so I
- 32:49spent I spelled f folder wrong now it
- 32:54should
- 32:55work it should not throw any errors at
- 32:57me anymore so just press buy and I can
- 33:02go through it now
- 33:04great all right so what I'm going to do
- 33:07now is
- 33:09just enter my main server script and
- 33:13what I'm going to do is out of here when
- 33:14we are looping through all the doors is
- 33:17just do door okay so uh door do surface
- 33:22gy so door do surface
- 33:25gy do right
- 33:28label. text is equal to and just do
- 33:32door. price. value and now if you play
- 33:35the game it should display the price of
- 33:37the
- 33:39door and yes it does display the price
- 33:42of the door but we also need to put in a
- 33:45space and
- 33:50coins and now it should work okay so it
- 33:54works can't go through it now but we can
- 33:56purchase it and we can go through
- 33:59and yeah I think this is going to be it
- 34:01for today's tutorial if this helped
- 34:03Please Subscribe like the video share it
- 34:05with your friends and I'll see you all
- 34:06in the next video bye
About this transcript
This page contains the full transcript of [NEW]How to make A Pet Simulator X Game on Roblox - Part 2 by polarisprog, generated from the public captions YouTube serves with the video. The transcript has 4,768 words across 693 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.