YouTube Transcript:
Sandbox Tycoon Tutorial: P3 - Plot system (Roblox Studio)
Skip watching entire videos - get the full transcript, search for keywords, and copy with one click.
Share:
Video Transcript
Available languages:
View:
welcome back to the sandbox Tycoon
Series in this video I'll be showing you
exactly how to set up a plot system now
this system is not going to be one where
you choose exactly what which plot you
want instead we're going to be doing a
system where the server hands out plots
automatically I may do a series a mini
series that kind of adds on to this one
after the fact that adds in those
features that people request and
they didn't make it into the main
series but I'm not going to promise
anything but anyway we will get into the
video actually before that I'm just
going to promote my Discord server and
yeah so pretty much there my Discord
server is the best way to get in contact
with me and the rest of the you know
people that watch the videos so
subscribers or you know the community I
guess and essentially there's the you
know Dev support channel so you can you
know submit support on different for uh
you know you can ask for help
essentially there's project there's the
projects Channel where you can submit
your projects that you've been working
on there's a whole ton of stuff I'll
show you a you know screenshot of all
the different things or a video or
whatever showing all the different
things you'll have to come and see what
all come and join the server to see what
all of them are but
yeah anyway hopefully I'll see you in
the server and let's just move into the
video okay so the first first thing I'm
going to do is I'm actually going to
create a folder in server script service
now I actually forgot to do this in the
first video so we're doing it here but
anyway we're going to create a folder
and we're going to call This Server
modules the reason for that is we're
going to put a module script in here you
may be asking why don't we just put it
in modules well let me just let me let
me so we're going to call this plot manager
manager
okay and in here we're also going to
call this plot
manager we can just go ahead and duplicate
duplicate
that and basically what this module is
going to do is it's we're going to
create a server script actually here
we're going to call this plot man or
plot Handler so plot Handler basically
just a different name of saying plot
manager uh but the module is essentially
going to assign a plot now the module is
going to hold the functions to do that
we're also going to have another
function to
return the plot to the server now the
reason why we're putting it in server
modules and not modules is we want we
don't want the client having access to
setting players plots like that wouldn't
make any sense exploiters would go crazy
with that one they would set people's
plots to different things or whatever I
don't know they would just call it on
different things and they would
basically yeah go crazy so we don't want that
that
we're doing it in server modules so that
the client cannot cannot physically do
anything so let's just go ahead and go
into plot manager and create a couple of
functions so the first function is going
to be for assigning the plot so we're
going to say plot manager Dot and then
we're going to do
assign uh plot this is going to take in
two parameters the one first one is
going to be the location and the second
one's going to be the player that we are
now in this function really all we're
going to do is we're going to make a for
Loop which is going to be four IV in
pairs and we're going to loop around Lo get
get
children we're going to say do
and we are actually going to yeah so I
guess this is it actually then what we
can say is we can check if and actually
I'm going to change V to
PLT uh just for the sake of making this
more readable so if PLT Dot and
basically what we're going to be
checking is if this owner value is empty
so if it is we're going to set the plot
to that player so we're going to say if
plot. owner. value is equal to an empty
string then we're going
to return or we're going to set PLT do whoops
whoops
owner. value
uh to whoops plr
do pl.
name so you may be wondering why are we
not just saying if PLT is equal to nil
well string values actually
don't you for some reason at least in my
experiences they
don't empty values are equal to an empty
string and not nil for some reason I
don't know why this is if you know
comment down below and help people out
but if you don't just know that this
value is an empty string and not nil I
don't know why it makes no sense
but yeah it is that's the way it is and
yeah so you can't check if it's equal to
nil you have to check if it's empty
string for this to work so then of
course we also have to break out of this
Loop so we're just going to call Break
um or write out the break statement
which basically is just going to break
out the loop because we don't want to be
setting multiple plots to our player
it's kind of the thing we're trying to
avoid putting this in server uh server
modules uh so the second function is
going to be again we're going to say
plot manager Dot and this is going to be
return plot
okay again this is going to take in two
parameters the uh actually no we're just
going to give the oh never mind mind we
are actually going to need that one so
we're the same amount of parameters as
the other one so then we can also put a
four I PLT in pairs Loop we can loop around
around [Music]
[Music]
the children and of course I put an
needed okay so here instead of checking
if the value is equal to to this empty
string we are actually going to be
checking if PLT do owner. value is equal
to plr name and if it is we're going to
return PLT and then we don't have to
write our break since return already
stops the code from
running so the reason why we're doing
this function is this is going to be if
the client requests the plot then we can
easily just hand it out to them because
the client is going to need to know the
plot that they have
have so
so
yeah this is just going to be how we're
going to do it okay so now in plot
Handler we're going to need a couple of
different things so first off I'm just
going to get uh the player service which
is going to be equal to game get service
and then players if I could type then we
are going to get the uh module so we can
say local PL plot
manager equals require and then we can
give it not a
string scripts.
parent. uh server
modules. plot
manager and that's essentially going to
give us the plot manager it's going to
return the functions allow us to use
them as you can see if we type plot
manager dot it's going to give us a list
of the
functions so that's that so now we can
say when someone joins the game so
player added then we can connect
to we're going to call this function
we're actually going to declare a
function up here so
local function you may be wondering if
you're new to scripting and all you
should know this but if you are just
watching this the reason why we didn't
declare local is because this is going
in here and we don't want everything to be
be local
local
um so we Define local function and I'm
going to call this function I don't know
let's see what would be a good name so
what are we trying to do when the player
joins we're going to what assign the
plot so we're going to just we're going
to again call this assign plot and we're
going to give this plr and then we can
assign to or connect to sign plot so
when the player joins the game we're
going to invoke this function invoke
just means call the
function so all we're going going to do
is call on the plot manager assign plot
and we just give it the player that just
joined the game that's all there is to
it now we're also going to be making a
function so local
function and we're going to call it
request plot we're again going to give
pass the player now this is going to be
needing a remote function so we're going
to use a remote function here we're
going to do duplicate request placement
and we're going to call this instead of
request placement we're going to call
this request
plot so we're actually going to go and
get that up here so
local uh remote R RF is going to be
equal to we're actually just going to
get the replicated storage service so
local replicated whoops
look replicated storage equals game get
service replicated storeage
so then we can say that the we can just
give it the path so we can say
replicated storage Dot and then we can
see signals do remotes do functions do
request plot and that's all there is to
it then we can fire that when the when
it's called so down here we're going to
put it right above here uh remote RF do
on server in
basically on server invoke is
essentially when we call or we send
information to the server and then we
have to give it a function so we can say
on server invoke this is basically when
the remote function is fired or invoked
we can just set that to request plot and
we get rid of that so pretty simple syntax
all it's saying is instead of connecting
to the function we just pass in this
function here we don't give it
parameters unless well no we don't give
her parameters here we don't or open and
closing parentheses is what I
meant so what we can do is we can
essentially just return or first off we
need to check
check
um you know what actually know we don't
need to do anything we can simply just
return plot manager if I can type here return
return
plot of course we will have to give the
location I actually forgot about that up
here so the location in this case is
just going to be uh workspace do
plots yep or
lowercase so again we're going to need the
the
workspace plots and then we give it a
okay so now everything should line up if
we call return plot we we get the
location it Loops through if the owner
is equal to the name then we
return so now we have two functions how
do we use them well let's go down
into let's say client
placement and instead of in here instead
of function RF we are going to
going to just duplicate that line we're
going to call this get plot RF actually
you know I'm just going to call it get
plot and instead of request placement we
can just replace that with
plot so that's just going to get this
thing so we can actually just create a
variable to Fire and get the plot so
instead of workspace plots. plot one we
can set it to get
plot and then we can say invoke
server yep server so now this is going
to fire and whatever it returns whatever
whatever this function uh whatever this
function returns we're going to set that
works all right so let's see what plot
we were given so obviously plot one
let's just make sure we didn't get plot two
two
3 or four I'll click on plot one and as
you can see it worked we have the
placement system working it puts it into
the correct
plot and yeah this is pretty much it so
you may be saying to yourself well we
didn't teleport to the plot
plot
so that's actually quite simple now we
are actually going to do it a little bit
of a um whatever you call it we're going
to be doing it a little bit of a
interesting way so instead of actually
doing the math and calculating okay if
the plot is rotated this way then just
move it to here or something we're just
going to create a part that we're going
to teleport to so I'm going to create
four parts here so 1 2 3
four and I'm just going to select them
all so I can give them properties the
same I'm just going to make these
anchored we're going to turn C cide off
so there's absolutely no way that they
can figure out that they're here
we're going to set the transparency to
0.5 and then basically we just have
to put them in the place that we want so
we can bring
this right here can bring this one
one
right here by the way if you don't know
how to teleport to uh Parts like this
you just press F on the
keyboard so it's really actually quite
useful just going to put this one right
here and that looks good so now we can
just call these wonder is there a way
to no I'm just going to call each one of these
these
Telly so just like
that same thing with this
one that
one that one so now if we open up here
we can just say that okay this one goes
this one is plot three and then this one's
one's
obviously plot
four so we're going to put a script in
starter character scripts or maybe
starter player scripts I don't remember
which one I think starter character
scripts is what we're going to use
because that's whenever the character
load so that actually is good so we can
say that local character since this is
going to load in the character is just
equal to script. par because that's
going to be what it is and if we want to
test that out we could just print it out
I'm not going to do that I know this is
going to work but yeah so how do we get
the well plot well we're actually going
to go in here and we're just going to
copy what do we need we
need basically
this so we're going to paste it in we're
going to get rid of you know never mind
we don't need that oh right and we're
also going to
here put services at the
top and okay so now we have everything
that we need except we don't need this
one right here
here
so we're going to yeah what we're going
to do is we're going to say that yeah
we're going to request a plot so we're
going to say that local plot equals uh
get plot
and then invoke
server and then below that we can say
character set primary part whoops oh yeah
yeah
set primary part cframe we give it a new
cframe we can give it plot. X or whoops plot.
plot.
do cframe dox plot
do Telly do
cframe doy and actually on the Y I'm
ploty
dot cframe here we go so now we have all
of our
axes now what do we do we uh have to say
CF frame. new of
course so this should actually be it if
we hit play hopefully we'll teleport to
the correct
plot as you can see we did so that is
essentially all we have to do very
simple that's it so I'm just going to
call this teleport script or
teleport Char I'm going to call it teleport
teleport
Char and then finally I'm just going to
click on all of these teleport bricks
and make them fully invisible so we
don't know that we're teleporting onto
them and it doesn't look weird like when
I just tested it so anyway hopefully
this did help you I'm going to go over
the code one more time just to make sure
that it is you know making sense so
first of all we make a met plot or a
module it's going to contain two
functions the first one is going to
assign the plot so that's we Loop
through the location provided then we
check if the owner is equal to an empty
string remember we have to say empty
string and not a nle value
so yeah and if it is if this returns
true then we are going to sent that to
the player the player's name not the
player itself we're not using object
values like I did in the last series and
then of course we just go ahead and
break and these ends do the rest they
yeah and the function so anyway in the
second function this is going to handle
returning the plot so it's essentially
the exact same thing as this
instead well it's slightly different the
changed bit is essentially right here
this is the big point so pt. owner.
value so if pl. owner. value is equal to
the player. name or the player name then
we're just going to go ahead and return the
the
plot and obviously in plot Handler we
are just going to create a couple of
functions to handle those we may like I
created functions so that if we wanted
to add in something we don't have to do
it 100 times um I guess we would be
creating functions either way if I did
connect to a function but this just
makes it easier I like to create
functions that actually have names
anyway this just Returns the plot uh
when the client requests it and this
assigns the plot when the player joins the
the
game and of course in here we get the
plot from here as well as in teleport CH
and I'm pretty sure you probably will
know what this is so anyway that's that
I'll see you in the next video let me
just test it one more time just to prove
that it works
and here we
go that is that's all there is so anyway
hopefully this helped and I'll see you
Click on any text or timestamp to jump to that moment in the video
Share:
Most transcripts ready in under 5 seconds
One-Click Copy125+ LanguagesSearch ContentJump to Timestamps
Paste YouTube URL
Enter any YouTube video link to get the full transcript
Transcript Extraction Form
Most transcripts ready in under 5 seconds
Get Our Chrome Extension
Get transcripts instantly without leaving YouTube. Install our Chrome extension for one-click access to any video's transcript directly on the watch page.
Works with YouTube, Coursera, Udemy and more educational platforms
Get Instant Transcripts: Just Edit the Domain in Your Address Bar!
YouTube
←
→
↻
https://www.youtube.com/watch?v=UF8uR6Z6KLc
YoutubeToText
←
→
↻
https://youtubetotext.net/watch?v=UF8uR6Z6KLc