00:00:00
hello everyone in this video I'm going
00:00:01
to show you how to make an Obby on
00:00:03
Roblox so the first thing we need to do
00:00:05
is to open up Roblox studio and go to
00:00:07
the new tab over here and click on base
00:00:10
plate uh and after that loads it will
00:00:13
open up this place and what we need to
00:00:15
do is go to the view tab over here and
00:00:18
click on Explorer and properties now
00:00:21
that we have these two tabs what we need
00:00:23
to do is to just get rid of everything
00:00:25
in the workspace we're going to get rid
00:00:27
of the spawn location and the base plate
00:00:30
then we need to create a part so click
00:00:32
on part right here and set its position
00:00:34
to 0 comma 0 comma 0 and it will Center
00:00:38
it now we need to change the size so the
00:00:42
size I want that to be something like 10
00:00:44
comma 1 comma 10 and then I'm going to
00:00:49
uh uh change the color to to a green
00:00:53
color and what I'm going to do is group
00:00:56
it into a model so just contrl G to
00:00:59
group it it or you can right click and
00:01:02
click group as model and now we will
00:01:05
rename this to one uh one stands for the
00:01:09
first checkpoint so we're going to add a
00:01:11
folder to the workspace and we'll name
00:01:13
it
00:01:15
checkpoints okay now we're going to take
00:01:17
this checkpoint right here and we're
00:01:18
going to put it in the checkpoints
00:01:20
folder and also make sure that that uh
00:01:23
the anchored property is checked on your
00:01:26
part so uh make sure it's anchored and
00:01:29
now I'm going to change the Sky Box
00:01:32
because I really don't like don't like
00:01:33
the gray over here so I'm going to go to
00:01:35
U uh models and I'm going to look for
00:01:38
sky and I'm going to choose this one
00:01:41
okay that's good okay so now I'm going
00:01:43
to create a simple stage so I'm going to
00:01:46
create a part I'm going to scroll down
00:01:48
to position and I'm going to set it to 0
00:01:51
comma 0 comma 0 so that I need the
00:01:53
center and I'm going to drag it here and
00:01:55
I'm going to scale it like this I'll
00:01:59
make it a bit big bigger and I'm going
00:02:01
to uh drag it over here and I'm going to
00:02:04
make sure that anchor is checked and I
00:02:06
also want to make this one stud okay so
00:02:10
uh now I'm going to uh um duplicate this
00:02:14
I'm going to put one right
00:02:16
here I'm going to select both of these
00:02:19
and put them here now I'm going to
00:02:21
select uh another two of these and put
00:02:25
them here okay so now I want to change
00:02:27
the colors I'm going to make the first
00:02:30
one red the second one uh blue the third
00:02:33
one I want that to be uh green the uh
00:02:37
fourth one I'm going to make it uh
00:02:39
yellow the uh fifth one I think I'm
00:02:42
going to go for pink and the uh uh last
00:02:46
one I think I'll just uh make orange
00:02:51
okay so now we need to duplicate our
00:02:53
first checkpoint and put it over
00:02:56
here and now we have two checkpoints I'm
00:02:59
going to call the the the second
00:03:00
checkpoint too okay so now I'm going to
00:03:03
play the game actually no it's not going
00:03:05
to work yet uh I'm going to uh make
00:03:08
another stage I'll just uh duplicate
00:03:11
this part and I'll just do this and I'll
00:03:15
make this a big
00:03:18
part and I will just uh take another one
00:03:22
of these parts and I'll put it right
00:03:24
here and this is going to be a laser
00:03:27
that the player is not supposed to touch
00:03:29
so make sure that can cide is unchecked
00:03:31
so just scroll down on the laser and
00:03:33
make sure that can Collide is
00:03:35
unchecked uh I'll just uh make this
00:03:38
smaller I'll just go for an increment of
00:03:41
0.5 and I'll just squish
00:03:44
this and I will drag it here and I'm
00:03:49
going to make the color uh a red and
00:03:53
neon okay now I'm going to change the
00:03:55
color of this to uh a nice white and I'm
00:03:58
going to duplicate this this I'm going
00:04:00
to put one here I'm going to duplicate
00:04:02
I'm going to select both of these now
00:04:03
and put them here and duplicate them
00:04:06
again and put them
00:04:08
here okay so I know this isn't equal but
00:04:11
it's not supposed to be perfect so I'll
00:04:14
just first of all make this a little
00:04:15
bigger and we just make sure that
00:04:17
everything is anchored okay so now we
00:04:19
going to add a folder to the workspace
00:04:21
and we're going to call it kill bricks
00:04:23
kill bricks and we're just going to
00:04:25
select all of our lasers and put put
00:04:30
them in the folder that we just created
00:04:33
okay so uh now I'm going to duplicate
00:04:36
this checkpoint and this time it's going
00:04:38
to be called
00:04:42
three and now we're going to get started
00:04:44
on the actual scripting so I'm going to
00:04:47
create a uh script in server script
00:04:50
service and I'm going to call it um
00:04:56
checkpoints and what I'm going to do is
00:04:58
I'm going to get Flo
00:05:01
players players is going to be game game
00:05:04
call get service players and uh then
00:05:07
we'll just uh write in local
00:05:11
checkpoints equals uh workspace do
00:05:16
checkpoints and
00:05:19
um then we'll just going to uh do
00:05:22
players player added call connect
00:05:24
function and that's going to take the
00:05:26
player and we're going to do player do
00:05:28
character added colon connect colon
00:05:31
connect colon connect uh player
00:05:34
character added character added colon
00:05:36
connect function and that's going to
00:05:38
take the character okay so when a new
00:05:40
player is added we want to call this um
00:05:44
uh go to checkpoint function so we're
00:05:46
going to create a local function uh
00:05:48
teleport to
00:05:52
checkpoint and that is going to take the
00:05:54
player and the
00:05:58
character okay so now what we want to do
00:06:01
is uh call the teleport to checkpoint
00:06:05
function and we're going to send the
00:06:07
player and the character but before we
00:06:09
do that we need to repeat task. wait
00:06:12
until character do uh primary part is
00:06:16
not equal to n okay so what this does is
00:06:19
uh each time a player is added it checks
00:06:22
if the character is added uh so whenever
00:06:24
the character is added so if the player
00:06:26
dies and respawns uh this uh event will
00:06:29
be called and we're just going to wait
00:06:31
for the primary part to be loaded and
00:06:33
then we just call this teleport to
00:06:35
checkpoint function now here's what
00:06:36
we're going to do before we script this
00:06:38
teleport to checkpoint function I'm
00:06:40
going to create another script and I'm
00:06:42
going to call it player
00:06:45
data and what I'm going to do is get uh
00:06:48
players again equals game CL get service
00:06:51
players and we're also going to get data
00:06:54
store
00:06:55
service go g get service data store
00:06:58
service and players. player added col
00:07:00
connect function and that's going to
00:07:02
take D player and now players. player
00:07:04
removing col connect function and that's
00:07:06
also going to take D player okay so
00:07:08
we're not going to script the data store
00:07:10
yet uh we're first going to create the
00:07:12
leader stats so look leader stats equals
00:07:14
instance. new folder and leader stats.
00:07:18
name equals leader stats and leader
00:07:21
stats. parent equals player now we need
00:07:23
to create a stage value so stage equals
00:07:25
instance. new in value and Stage do name
00:07:29
equals stage and stage. value equals uh
00:07:33
1 and uh stage do parent is going to be
00:07:37
leader s okay so now um so what this
00:07:40
does is each time a new player is added
00:07:43
we're going to create a folder now the
00:07:45
uh way leader stats Works which is the
00:07:48
leaderboard that shows up here in the U
00:07:50
right
00:07:51
corner uh so basically you need to
00:07:54
create a folder and call it leader stats
00:07:56
and spell it exactly like this and then
00:07:58
you can insert values to that folder and
00:08:02
they will uh show up uh uh in the
00:08:05
leaderboard so what we're doing is
00:08:07
creating a new end value which is an
00:08:10
integer and uh we're just setting it
00:08:12
name to stage and the value the default
00:08:15
value is going to be one and the parent
00:08:17
is going to be the folder that we just
00:08:19
just created now if you go ahead and
00:08:21
play the game we should have a uh leader
00:08:27
stats um folder in the player and a uh
00:08:32
stage value in the leader
00:08:34
stats okay so as you can see we have a
00:08:38
uh stage value over here in the
00:08:40
leaderboard and we have a leader stats
00:08:42
folder and the stage value is inside of
00:08:44
it so now what we need to do is to uh
00:08:48
make the player teleport to the
00:08:50
checkpoint so here's how this is going
00:08:52
to work uh we're going to do um uh
00:08:57
character we going to do local
00:08:58
checkpoint
00:09:00
equals checkpoint conf find first child
00:09:03
and we're just going to do player two
00:09:05
string player do uh leader stats
00:09:10
dot uh stage.
00:09:14
value and what we're going to do is
00:09:16
character Doh humanoid root
00:09:20
part. cframe uh equals checkpoint
00:09:25
primary
00:09:26
part. cframe
00:09:29
okay now this right now is going to
00:09:31
error so what we need to do is Select
00:09:34
our checkpoints over here and set the
00:09:37
primary part of each one to the uh part
00:09:40
inside of it so I'm going to do that
00:09:42
click on primary part part uh primary
00:09:46
part again and part and what I want to
00:09:49
do is right click on the uh part and
00:09:52
click uh show orientation orientation
00:09:55
indicator okay so this is
00:09:58
correct
00:10:00
uh I'm going to play the game now and
00:10:01
see if this
00:10:05
works now right now this will not work
00:10:08
and the reason for that is because we
00:10:09
are setting the C frame of the player to
00:10:12
exactly to the uh to the C frame of the
00:10:17
uh checkpoint so what we need to do is
00:10:18
multiply that by CF frame. new and we're
00:10:20
going to add eight studs and zero so
00:10:24
we're just positioning the player a
00:10:26
little bit upwards and that will work
00:10:30
okay so I'm going to wait for my player
00:10:31
to load uh I don't know why Roblox is
00:10:34
extremely slow for me uh these past few
00:10:37
days okay so it does work as you can see
00:10:39
it uh took me to the checkpoint uh but
00:10:43
uh we can't really um Mark each
00:10:46
checkpoint and the killer breaks don't
00:10:47
kill us yet so what we're going to do is
00:10:50
we will enter our checkpoints script and
00:10:53
what I'm going to do is for underscore
00:10:55
come we're going to Loop through each
00:10:56
and every checkpoint in the checkpoint
00:10:59
folder so for undor comma checkpoint in
00:11:02
checkpoints uh calling get children do
00:11:05
and we'll just check if make sure that
00:11:07
this is checkpoint not checkpoint now
00:11:10
we're going to do checkpoint uh dot uh
00:11:13
primary
00:11:14
part do touched coln function and that's
00:11:19
going to take hit now um if something
00:11:22
touches the primary part it might not be
00:11:24
the player so we will'll check if uh hit
00:11:29
parent can't find first child
00:11:33
humanoid then so if we find a humanoid
00:11:37
then it's probably a player so what
00:11:39
we're going to do is local player equals
00:11:41
uh players calling get player from
00:11:43
character hit. parent now uh the
00:11:46
character will be hit. parent and we're
00:11:48
getting the player from that and what we
00:11:51
need to do now is uh check if player do
00:11:56
leader stat so if make sure to use
00:11:58
parentheses is if player do leer
00:12:01
stats do
00:12:03
stage do Value Plus One is equally equal
00:12:09
to checkpoint to two number checkpoint
00:12:13
do name then we're going to do player.
00:12:16
leer stats do stage. Value Plus equals 1
00:12:22
plus equal 1 by the way this these are
00:12:25
two equal signs but my font just uh
00:12:27
turns them into one long equal sign okay
00:12:30
so uh now uh I'm going to explain this
00:12:33
so uh when the player touches the
00:12:36
checkpoint uh in order to check if it is
00:12:39
the right checkpoint and that we should
00:12:41
add one to the uh player stage uh we are
00:12:45
checking that if we add one it's going
00:12:49
to be equal to the number to the number
00:12:52
of the checkpoint so if we are at stage
00:12:55
two and we touch checkpoint number three
00:12:57
if two + 1 is equal equal to 3 then
00:13:01
we're going to add uh 1 to two if that
00:13:04
makes sense now I'm going to play the
00:13:06
game and this should work okay so a
00:13:09
moment of truth I'm going to uh complete
00:13:12
my Obby and I'm going to go to stage
00:13:14
number two and as you can see we are at
00:13:16
stage number two now if we just go back
00:13:19
it will not turn it to one as you can
00:13:21
see and if I just go ahead and uh reset
00:13:26
my character here it should teleport me
00:13:28
to checkpoint number two and as you can
00:13:31
see it does work and I'm just going to
00:13:32
show you that it works by going to uh
00:13:35
checkpoint number three and if I reset
00:13:37
my character again it should take me to
00:13:39
checkpoint number three and it does okay
00:13:42
so now what we need to do is make the
00:13:45
kill bricks work so I'm going the same
00:13:48
way we did with the checkpoints we're
00:13:49
going to do that with the uh kill bricks
00:13:52
so local kill bricks we're going to
00:13:53
create a variable up here uh local kill
00:13:57
bricks equal equals workspace do kill
00:14:01
bricks okay now we're going to Loop
00:14:04
through the kill bricks so for
00:14:05
underscore comma kill brick in uh kill
00:14:09
bricks calling get children do and we're
00:14:11
going to do kill brick uh do
00:14:14
touched uh this should be a uppercase
00:14:18
and uppercase B sorry kill brick.
00:14:21
touched call connect function hit same
00:14:24
thing here if hit. parent confin first
00:14:28
child
00:14:30
humanoid then it is a real player so
00:14:33
we're going to get the player by doing
00:14:34
players calling get player from
00:14:36
character hit. parent and uh now what we
00:14:39
need to do is uh check if humanoid if uh
00:14:45
actually have a better idea we can just
00:14:46
do local humanoid equals and just copy
00:14:49
this line of code right here and then in
00:14:52
here we can just check if humanoid uh
00:14:55
then we can just check if humanoid
00:14:59
health is not equal to zero then then
00:15:05
just copy
00:15:07
this and then we can just do humanoid uh
00:15:10
do Health equals zero so we just kill
00:15:13
the player when he touches a kill
00:15:16
break okay let's see if that works okay
00:15:18
so I'm going to complete the Obby again
00:15:21
oh I
00:15:23
fell okay we'll just complete the
00:15:26
Obby and let's hope not to fall this
00:15:29
time okay so I'm going to touch this and
00:15:31
as you can see it does in fact kill the
00:15:34
player okay and it does take me to the
00:15:36
right checkpoint okay so I removed the
00:15:40
uh data store the data store service and
00:15:42
and the data store variable uh and the
00:15:45
game players play moving event uh that's
00:15:48
because we're going to be doing that in
00:15:49
the next video but for now what I'm
00:15:51
going to do is I'm going to be showing
00:15:52
you how to make a progress bar so I'm
00:15:54
going to create a screen gy and I'm
00:15:56
going to call it uh main SS I'm going to
00:15:59
create a frame and this Frame I want the
00:16:02
size to be
00:16:04
um to be
00:16:06
0.5 comma 0 comma
00:16:09
0 uh 1 comma 0 and I'm just going to
00:16:14
resize it now and I'm going to put it
00:16:16
right here okay and I'm going to add a y
00:16:19
corner and I'm going to set the corner
00:16:22
radius to uh 0.2 comma 0 and then I will
00:16:27
duplicate this Frame and and put it
00:16:29
inside of the other frame and set the
00:16:31
size to 1 comma 0a 1 comma 0 and now
00:16:34
we're going to set the Anchor Point to
00:16:36
0.5 and the position to 0.5 comma 0
00:16:42
comma 0.5 comma 0 now now I'm going to
00:16:45
make this smaller and I'm going to
00:16:46
change the background color to a uh nice
00:16:51
green color but I also want to add a UI
00:16:54
stroke just to make everything pop up a
00:16:57
little more
00:17:00
uh okay I think I think this is good
00:17:04
enough okay that's perfect now I'm going
00:17:07
to make I'm going to call this progress
00:17:09
I'm going to just call this bar and I'm
00:17:11
going to call this uh progress bar
00:17:15
background and what I'm going to do is
00:17:18
add a uh local script to the progress
00:17:22
bar to the uh progress
00:17:24
bar local script and I'm going to call
00:17:27
it uh
00:17:28
progress bar and I'm going to get
00:17:32
players equals game get service players
00:17:35
and now we're going to get the player
00:17:36
equals players. local player and now
00:17:39
we're going to do a local function
00:17:41
update uh
00:17:43
progress bar and now we'll we we'll just
00:17:47
do
00:17:49
um player col with for child leader
00:17:54
stats col with for child stage do chain
00:17:58
colum connect function and this will
00:18:02
just take value and we're just going to
00:18:05
call the update progress bar and it will
00:18:09
take uh a value and we're going to type
00:18:12
in value okay now we're also going to do
00:18:15
uh update progress bar actually no we
00:18:18
don't need to do this sorry we don't
00:18:20
need this okay so uh here's how this is
00:18:24
going to work I'm going to get the uh
00:18:25
checkpoints in the workspace local
00:18:27
checkpoints
00:18:28
equals hasht workspace going wa for
00:18:31
child
00:18:32
checkpoints uh sorry just get rid of the
00:18:36
hashtag and now we're going to do local
00:18:39
total
00:18:41
checkpoints equals # check points go on
00:18:45
get children and local
00:18:47
current stage equals player. leader
00:18:52
stats player uh call Wa for child leader
00:18:55
stats call wait for child call wait for
00:18:58
child stage do value and now we need to
00:19:02
figure out the
00:19:04
percentage so we're going to do local X
00:19:07
which is going to be how long the bar is
00:19:10
going to be it's going to be the um uh
00:19:13
current stage and we going to divide
00:19:14
that by the uh total
00:19:20
checkpoints and now we'll just do uh
00:19:23
we're going to get tween service so
00:19:25
local tween
00:19:27
service equals game col get service
00:19:29
tween service and we're just going to go
00:19:32
down here and do tween Service uh tween
00:19:35
service col create um script. parent
00:19:40
comma and twin info. new
00:19:43
0.5 or maybe 0 0.5 and we're going to do
00:19:47
size equals us2 from scale and we're
00:19:50
going to do X comma 1 and add a con play
00:19:54
okay let's try this out and see if it
00:19:57
works now uh one thing that I forgot to
00:20:00
mention is that the Anchor Point of the
00:20:02
bar should always be just 0 comma 0 and
00:20:05
the position is going to be 0 comma 0
00:20:08
comma 0 uh 0 comma 0 comma 0 comma 0 now
00:20:13
if you play the game it should work okay
00:20:16
so as you can see uh the health bar
00:20:18
works I'm going to go to stage number
00:20:20
two and this will change okay so yeah
00:20:24
that uh works if I go to stage number
00:20:27
three uh um it will go to 100% okay so
00:20:31
that's going to be it for today's
00:20:32
tutorial if this helped Please Subscribe
00:20:34
like the video share it with your
00:20:36
friends and I'll see you all in the next
00:20:38
video bye