YouTube2Text

Local Scripts (Server vs Client) - Roblox Advanced Scripting #1 — Transcript

by BrawlDev · 2,587 words · 137 segments · language en · Watch on YouTube

Full transcript

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