Local Scripts (Server vs Client) - Roblox Advanced Scripting #1 — Transcript
Full transcript
- 0:00hey thanks for stopping by welcome to the first episode of my Roblox Advanced scripting tutorial
- 0:07series and if you haven't checked out my beginnner scripting tutorial guide I made a few months back
- 0:12then I would highly suggest you watch that one first before watching this one because we're
- 0:17going to be uncovering more complicated and more advanced topics in regards to Roblox scripting
- 0:23so if you think you're ready then you're basically on the right track to becoming a a top tier Roblox
- 0:28developer and I figured for the first episode I think it would be important to discuss about local
- 0:33scripts and the server client model because you're going to be knowing about this model for basically
- 0:40the entire time you're going to be developing games on Roblox so this is going to be a very
- 0:44important one so any Roblox game regardless of whether it allows more than one player per server
- 0:50or not follows a multiplayer model called the client server model and to understand a little
- 0:56bit more about the client server model let me turn your attention to to a drawing that was created by
- 1:03the Roblox developer Hub and I think this is a really great drawing so so let's go to that
- 1:08real quick all right so there's two very important aspects to know about for the server client model
- 1:13and the first one we'll be discussing about is the server the best way I can describe the server is
- 1:18it's basically a reserved section of any Roblox game that oversees the whole game itself so if I
- 1:26just drag this along really quick you can see that the server can be represented as the game itself
- 1:34where you can see that there's three players that are inside of the game and the camera is directed
- 1:40away from any specific player so it's kind of like an overseer it kind of oversees the whole
- 1:49game and it controls everything that happens with the game so that's essentially the server
- 1:54but now to describe the client side a client is in the easiest way I can describe cribe the
- 2:00player itself each individual player so we have one player that's over here then we have another
- 2:06player and then we have our third player that's over here so we have three different players that
- 2:12all act as clients that are connected to the server which oversees everything the server is
- 2:19what controls synchronization among all three of the players that are inside of the game so
- 2:25you can see here one of the clients is one of the players um the camera is directed towards them and
- 2:33they're seeing every that's happening in the game from their perspective and that's going the same
- 2:40way for these other two players so there's three important things to know about with the server
- 2:45client model and the first thing is replication whenever something happens in the server it will
- 2:51be replicated to be shown in every single player that are in the server if a player decides to move
- 2:59their character character then it will show to other players that this character has also moved
- 3:06and replication is playing a factor in making sure that all the players are seeing exactly the same
- 3:15thing that's happening on the server another important thing is transmitting data between
- 3:21the server and also the client so usually if we want to change something through script where it
- 3:28will be replicated only to one specific person and not be shown to other people then we would
- 3:34use features like local scripts and I'm going to be showing you how those work in a little bit so
- 3:41there can be different ways of transmitting data there can be from one client to the server there
- 3:46can be from the server to one of the clients or there can be the server sending data to all
- 3:54the clients in the server so now that I'm done explaining how this works let me show you some
- 3:59in-game examples of how this would actually turn out all right so I'm in a game in pet Simulator
- 4:05X and I'm being joined by my ALT account that I just created so there's one thing to note here
- 4:11that's quite odd between the perspective of my account and my alternative account
- 4:17so on my alternative account you can see that I haven't unlocked the next area in pet Simulator
- 4:24X because I need to get 10,000 coins in order to uh buy the game to get to the next area but
- 4:32on my main account uh I have lots of progress in the game already and I already bought the gate uh
- 4:40to go to the next area so from my perspective I can see that the gate is not there but then
- 4:47on my alternative account that's new they cannot access the next area until until they get 10,000
- 4:53coins another example of local sided features is user interface so for instance these buttons on
- 5:01the left side you have hoverboard teleport Auto settings if I click on one of these it'll show a
- 5:08popup of a little panel that shows all the places I can teleport to now if I go to my ALT account
- 5:16on their side of the screen they can't see the popup for the teleport it's Unique to them only
- 5:22if they click the button so my ALT account can click the button to show the teleport but then
- 5:29on my main I can X out of this and open up the pets panel and on my alternative account it's
- 5:38still going to be on the teleport page so that's another big example of client sided gameplay all
- 5:44right so now we know having a good understanding of the client server model is really powerful and
- 5:50it's something we're really going to have to take into account for anything we do when we're trying
- 5:55to develop something whether we want to show something specific to a specific player or if
- 6:00we want to show something to all players it can be replicated throughout uh the entire game and
- 6:06so that's always just something that you should keep in the back of your mind but now what I want
- 6:10to do is show you how to access these different modes when you're creating on Roblox so if we hit
- 6:18test up here and then hit play then our character should be joining into the game like normal as
- 6:23a client so here's our character here um and in order to flip between what you see on the client
- 6:31versus what you see on the server we're going to go up here uh inside of the test ribbon ribbon as
- 6:37usual uh there's going to be a monitor here saying current client so this is the current perspective
- 6:43that we're seeing in the Roblox Studio window which is our player right here if we click on
- 6:49it we can actually see that the perspective has changed to the server now so our camera is now on
- 6:57the default location for the the server when the game starts up and as we can see we can freely
- 7:03move around in this server much like how we make games in Roblox Studio using the studio 3D world
- 7:11looking um map so if I click it again then it should go back to the perspective of the player
- 7:19and we should be able to move around freely like so so that's how you flip between the client and
- 7:25server perspective when you're creating a game on Roblox and to give you a little bit more of
- 7:30an understanding of what the perspective looks like between the two so let's hit stop and now
- 7:37what we're going to do is create our first local script on Roblox we create scripts to be able to
- 7:43give it instructions and make it do what we want to do in Roblox but there's going to be a lot of
- 7:49times where we want the things to happen only within a specific player and not have it be
- 7:55replicated onto the server and this is where local scripts come in so on the right side if you have
- 8:02your Explorer window pulled up I assume you have uh if you don't have it pulled up then you go to
- 8:06the view tab up here and then the Explorer and properties tab should both be here so let me just
- 8:12open both of these back up um and make sure you also have your output down here so we can see the
- 8:17results that we're about to print out so I'm just going to right click our output and then clear it
- 8:22uh so then let's create our local script on our Explorer let's scroll down a little bit and on our
- 8:29starter GUI we're going to hit the plus sign and then we're going to search for a local script and
- 8:35this is what it should look like so let's click that and then we see that it brings up the script
- 8:42editor and this pretty much looks exactly the same as you would see when you insert a normal
- 8:48script but this time this acts as a local script so we're not going to change anything here we're
- 8:53going to leave this as print hello world we're going to go back to our game we're going to hit
- 8:58test and then hit play so then what should happen is that we should see in the output uh hello world
- 9:07just like how we normally would in a uh regular script but here's the interesting thing if we
- 9:14hit current client and switch over to the server we can see that hello world is still here but if
- 9:23you see this colorcoded pattern here you can see that there's actually a color here that's blue
- 9:29and then down here is a color that's green so whenever you see an output down here where the
- 9:35color is highlighted to be blue that means that that this little line of code ran on the client
- 9:42and not the server so green means that it ran on the server but in this case our local script ran
- 9:49on the client as soon as one player joined the game that's when it decided to print out onto the
- 9:58output let's now make something that will only run on the client side and not have it be shown on the
- 10:04server so we're going to create a part where when a player steps on it it will print out a bunch of
- 10:10stuff in the output but only on the client so with our script that we created let's actually disable
- 10:16this uh we're not going to be using this for the rest of the tutorial and let's insert a part so
- 10:21let's go to model up here and then let's hit part to insert a new part into the workspace so let's
- 10:28just drag this along here let's change the scale of it a little bit and let's change the color of
- 10:35the part down here inside of properties and let's change the brick color to Yellow for instance um
- 10:43and now what we'll do is we'll go down here to starter player in the Explorer so open this up
- 10:50a little bit and you will see a section called starter character scripts so let's hit the plus
- 10:56sign here and let's create a new local script and then let's delete this code that's been
- 11:04given to us by default so first what we'll do is make reference to the part we'll say local part
- 11:11equals game. workpace do part so that will make reference to the part that we just created and now
- 11:19we'll add a touched event to that part so we'll say part. touched colon connect open parenthesis
- 11:29function open parentheses close parenthesis let's also delete this last line here enter and then we
- 11:36will say print and then in quotations we'll say like some random mumble jumble here okay so now
- 11:44let's go back to the game we'll hit test and we'll hit play okay so it looks like I got an error here
- 11:50uh saying that part is not a valid member of workspace what ended up happening was that
- 11:55the part didn't load in fast enough to catch that there was a part in the server so so we're going
- 11:59to have to wrap this around in a wait for child so let's delete part here and after workspace we'll
- 12:07say colon wait for child and make sure uh you have the case sensitivity correctly then we'll
- 12:14uh say open close parentheses and inside of here in quotes we will say part so now this is going to
- 12:20force the script to wait until part is loaded into the game so that we can actually run whatever is
- 12:26down here so let's touch this and as you can see on the client the part is printing out all this
- 12:33mumble jumble random nonsense this stuff isn't being printed out on the server now it may not be
- 12:39as clear to you because the only thing we can see here is the color difference let's do something
- 12:45more visual so we can actually understand it more so let's hit stop go back to our local script and
- 12:52instead what we'll do is we will change the color of the part when we step on it so let's delete
- 12:58this print statement here and let's try to write a line that changes the color of the part so we'll
- 13:05say part do brick color equals brick color. new and then in parentheses right here we will put in
- 13:17some quotes and say really red so now let's go back into the game and hit play so that we can
- 13:26see our expected result that has come about with our script so here we are and once we step on this
- 13:33plate then it should change the color to Red so as you can see the color has now changed to red but
- 13:39if we change our client to the server we can still see that the color is yellow because we created
- 13:47a local script that can only show what happens with this execution when this specific player
- 13:55touches this part it will only show it happening on on their screen and not be replicated to every
- 14:02other player that plays the game like if you just imagine that there's going to be another player
- 14:06here another player here and then there's another player here they're going to see that the part is
- 14:12still yellow even though you stepped on it and the color is now red but only you see the part being
- 14:20red not anybody else so that's pretty much that so that's pretty much the basics of local scripts
- 14:27and the server client model I will be going more into detail about these about local scripts when
- 14:33we tackle tools that require the starter pack uh and also gys when I start my guy tutorial series
- 14:40and things like that but this episode served as an introduction to local scripts and the server and
- 14:46client sided models so I think I've done enough to show that for this episode all right that's going
- 14:50to be it for this episode thanks for watching and I will see you in the next episode take care
About this transcript
This page contains the full transcript of Local Scripts (Server vs Client) - Roblox Advanced Scripting #1 by BrawlDev, generated from the public captions YouTube serves with the video. The transcript has 2,587 words across 137 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.