How to make simple NPC dialogue in Roblox Studio

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
howdy it's summertime my room is on fire I'm cooking in here it's actually really hot I'm thinking you know what uh Burning Alive reminds me of having to talk to people I don't like talking to people so uh I I thought it'd be pretty cool if I made like a dialogue system tutorial so no more stalling let's get right into it all right so first step instead of star GUI add a screen GUI and then add a frame we're going to name the screen GUI since I don't want to keep typing dialogue I'm just going to do the Handler it's the Handler and then we're going to name this uh frame text box then inside that ah no not yet we're going to change the Anchor Point in this of this Frame to 0.5 by 0.5 and then we're going to change the position of this Frame to 0.5 by 0.5 so it's in the middle actually we could just drag it down and scale it horiz constantly then change the first position fact to 0.5 so it's in the middle so now we have like this little simple text box so we can turn the background transparency down a little bit I'm going do 0.3 we can make it darker and then we can change the Border uh pixel size to be like three so now we have like this boring but functional text box so we're going to add a text label inside of that and we're going to scale the text label to match the text box we're going to enable uh where is it ah we're going to enable text scaled we're going to scale the top down we're going to scale the bottom up so the text is now a little bit smaller so if we were to for example type it fits so we can just put nothing there oh actually I'm going to do text again and we're going to set the background transparency to one and now we can edit our text so you can do like I'm going to do white and you can change your font right here so we can turn on Bold or italics uh there's like a bunch of Roblox fonts so I'm just going to pick like I'm just going to do this really like ugly robot one all right so now we can insert a local script and we're going to name it oh wait wait wait wait change this to uh DG we're going to change this to D Handler cuz this is what handles it this is the UI all right so we're going to do local text uh we'll just do local duy equal script. par local text box textbox equals script. par. text box local text label equals script up parent. textbox do text label and I think I have OCD cuz I don't like the way textbox looks so let's make it textbox of the capital B so we can just change this to text box text box all right it looks a lot better now so we're going to make a few functions we're going to make one to write the text and we're going to make one the uh and the dialogue so I'll explain that so local function right text and functions are pretty simple like every time you do this it will print whatever's in here like it will run whatever code is in here so I can do print hello and when I run this code you'll see it did hello three times inside of the output so that's functions but for this one we're going to add parameters so we're going to put text and wait time so these don't really have like meaning until we give it meaning so what we're going to do is we're going to do local text uh oops not local text label. text equals text uh let's add a sound inside of the uh UI let's go to toolbox and I'm going do sand sound it's the recent one so yeah just whatever that sound is we're to add that and we're just going to name it talk sound and inside of our script we're going to do local uh sound equals script. parent. talk sound text. text equals okay we're going to make sound play but we're also going to make guy. enabled equals true and textbox visible equals true and we can do f. weight uh wait time so the right text is done so what we could do with this is we could paste this function three times and right here you write whatever you want your text to be so I love cheese I actually don't like these I preer bread and then the wait time we'll do two two and four then I'll do test. we uh two so I love cheese will be the text it's going to wait 2 seconds and it's going to move on to the next text so we have our text which yep I love cheese I actually don't like cheese I prefer bread and it'll wait a little bit longer but it won't do anything yet cuz we have to make the end dialogue function so by default I want GUI to not be enabled so let's just do guy. enabled equals actually we could just copy this let Set both of these to Falls so if you play the game there's nothing showing so yeah I love cheese actually don't like cheese I prefer bread so we can we'll keep this and we're going to make a second function so we can copy actually no we'll just do local function and dialogue God motorcycle right outside my house all right so we have end dialogue and what we're going to do is we're just going to copy this put that in there change these to false and change text to be just a blank space like that so after 4 seconds we can call our n dialogue function so I love cheese I actually don't like cheese I prefer rad and it's gone so during dialogue I don't want like the dude to just be going ham jumping around so let's add let's like remove his ability to move so local uh player game. players. loc player local character equals player. character local uh I do and humanoid equals character. humanoid so so we can take this humanoid we can put it into our right text at the top we can do humanoid do uh walk speed equals zero and if you want to remove the player's ability to jump as well uh go into starter player and I like to use jump power instead of jump height so I'm going to set jump power to True right here character can use jump power instead of star player and then we're going to set humanoid do jump power equals zero and then copy both of those and inside of our end dialogue we are going to add these and we're going to put 16 and 50 all right so now if we test it you won't be able to move whil the dialogue is happening so when it starts I can't move anymore when it ends I'll be able to move again so there we go pretty simple works pretty well the only thing we need to do is we need to uh make it so when you interact with a uh player dialogue's triggered so we can we'll just keep this and we'll add okay I'm going to disable this inside of the storage UI I'm going to disable the DGI so instead of workspace I'm going to add a folder and I'm going to name it dialog folder and inside that well I'm just going to make a part I'm going to make a proximity part inside proximity prompt inside of that part I'm going to name that part uh for example say the dude you're talking to is Joe I'm going Make it Joe dialogue I'm going to put that into the folder and like if I wanted to make like a little character I could go here block Avatar R six and I would just like attach this to this chest so this tutorial is assuming the characters aren't moving I'll make an advance like NPC tutorial with dialog later but for now they're just not going to move so you have this dude he's just standing here so we we're going to Anchor the dialogue thingy we're going to turn the transparency the one and we're going to disable can Collide on that part then inside of our script we're going to add local dialog folder go gamew space. dialog folder and then local uh so like we can add like I'm going put all of our dialogue things here it's going to get like messy if you have a lot well not messy it's just there's going to be a lot of dialogue if you have like a lot of people to talk to but we'll do like Joel okay okay local Jo dialog equals dialog folder. Joe dialogue so we can go down here above here we can do Joe dialog. triggered oops Jo dialogue we need to actually get the proximity prop there the Jo dialogue have triggered connect function and we could just basic in oops so we have like this simple dialogue system I am Joe and make the second one just go and remove this one so let's just end dialogue and write text it's really simple so we can now interact with oh wait we need to disable the proximity prompt though so go dialogue. enabled equals false and at the end we'll do go dialogue that enable go through so you can't like interact with the proximity prompt when you're talking to Joe so let's actually let's change the dialogue prompt like we'll just change the prompt text to like talk to Joe and now we're good if we play it we can walk up to this man we could talk to Joe I am Joe Joe we're good we can't move around or jump while you're talking to them it's pretty simple so yeah that's how you can make really simple like just general dialogue if you want to make a second dialogue you would just do like we duplicate that and we're going to name like Fred dialog we would just change the proximity prompt to talk to red and then we would just loal Fred dialog dialog. Fred dialog. proximity prompt and we could literally just copy this and do Fred dialogue and Fred Fred uh red dialogue right so we have uh Joe red uh we can add talking equals false and we can go in here if talking equals false then it'll run else ah we don't need an else you can just copy this and paste it into the other one with the end and then we can add talking equals true and talking equals false we do the same thing for this top one that's a little bit confusing it's cuz I just remembered that like I need to add a fail safe so you can't like interact with multiple dudes at the same time so if I put these guys together if it works it should make it so I can only talk to one so I'm talking to Fred and if I bring Jo thing a little bit closer so let's talk to FR and talk to Joe Joe's won't do anything until I'm done talking the Fred and vice versa so that's a little fail safe so you can't like overlap and talk to multiple people it just won't work so yeah that's how you make pretty simple uh dialogue in Roblox Studio I'll make an advanced tutorial soon with like NPCs and like cuz I'm making like an advanced cut scene tutorial but yeah have a a good day thanks for watching uh don't explode I don't know
Info
Channel: RKGAM3ZS
Views: 3,625
Rating: undefined out of 5
Keywords: roblox studio, roblox, roblox scripting tutorial, roblox tutorials, roblox studio tutorial, roblox studio challenge, how to script in roblox studio, how to use roblox studio, roblox studio tutorials, how to script on roblox for beginners, roblox studio for beginners, roblox studio tips, cutscene tutorial, how to make cutscene on roblox, game development, roblox cutscene tutorial, roblox studio dialogue system, roblox dialogue system, roblox dialogue tutorial
Id: 3In8b4PppdY
Channel Id: undefined
Length: 14min 37sec (877 seconds)
Published: Sun May 05 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.