Full transcript
0:07Hello guys, welcome back to another
0:09tutorial. In today's tutorial, we're
0:11going to continue with the RNG series,
0:15but in today's video, we are going to
0:18remake it because the last series had a
0:23lot of issues.
0:25Um,
0:26so I felt that we need to remake it and
0:29make it better. So this is going to be
0:32almost exactly like um
0:36like uh Souls RNG game. So with that
0:41being said, please consider subscribing,
0:43liking this video and yeah, perfect.
0:49So first of all, we're going to make the
0:52button again. This time we are going to
0:54make a much more simple uh button.
0:59So
1:00we are going to make a frame.
1:05We're going to center it again.
1:08Use this plug-in unit conversion.
1:12We're going to change the position as
1:15well as the size to scale on both. Then
1:18we're going to go into the position,
1:21change the scale value to 0.5 as well as
1:24the Y value.
1:27Here we go. Uh or we can set the Y value
1:30to nine instead. We're going to scale it
1:34like
1:36this. Maybe
1:38we're going to make it uh either a gray
1:42or dark. Uh something like this. Set the
1:46background transparency to 6. Set the US
1:51stroke.
1:53And we're going to put this to a white
1:55one.
1:57Uh maybe two. And we are going
4:39symbol.
4:41Uh the second one
4:43is uh the percentage or the so for
4:49example we can say one out of two or if
4:52we put this to 15 we're going to say one
4:55out of five and if we put this to five
4:59we're going to say one out of five%
5:03ch chance chance of getting it and I'm
5:06going to put this so for example we're
5:10always going to reference with one. So
5:12if we say two, it's 50% chance that we
5:15get it.
5:17If we say four, it's 25% that we get it.
5:22So we can say 30.
5:25So
5:28uh or three sorry um
5:33the chance of getting it. And the sec uh
5:37the third one is the color
5:40of yeah the color of the channels.
5:45So we are going to duplicate it.
5:49I am going to rename this to rare.
5:53We're going to hide the chance a bit.
5:56Before you do anything, please put a
6:00semicolon here as well as here. not on
6:04the last one or yeah you can do it put
6:08semicolon after every
6:10new you make. So one out of five uh we
6:15can say one out of 10. So it's uh 10%
6:20chance of getting it here. We can say
6:23legendary
6:24just for the sake of this video. We can
6:27make the legendary one orange. We can
6:30make the rare one
6:32a bluish.
6:36Perfect. Um,
6:40okay. So, we're done with this u with
6:44our chance table. So, we're going to
6:47make the select chance function.
6:51So, we're going to return
6:54we're going to return a random uh
6:59We can say get random
7:03uh
7:05get random index
7:08which is equal to a function. We are
7:10going to say
7:12uh chance
7:14here we go for i comm, v in i.
7:20We're going to loop through our table.
7:25Uh we're going to say local uh random
7:29num
7:30equals to math.random
7:34one comma v index with number two
7:39for our second parameter.
7:42Uh
7:44if row uh if random number is equal to
7:49one and
7:51uh our
7:53chance is uh greater than
7:58uh the chance
8:01indexed with one and two then we're
8:05going to return
8:07uh we're going to return the first value
8:10going to return the second value and
8:13we're going to return a third value and
8:16then we are going to return our chances
8:22and this is the whole function. So if we
8:26go ahead
8:28and go inside of our main script
8:32and say locally replicated
8:35storage equals game get service
8:38replicate storage and local remotes
8:41equals replicate storage for child
8:44remotes
8:47and we're going to also define our
8:51modules. So select
8:54uh chance equals required script but it
8:59for child uh select chance. We can copy
9:04this. Ctrl Ctrl + V can say uh local
9:09chances or chance list
9:13equals uh chance list. There we go.
9:17And we can say remote
9:20uh wait for child
9:23uh ro function
9:25but on server invoke equals function
9:28player
9:30and we can say
9:35local table equals we can do it with a
9:39capital T. local table equals a empty
9:42table uh for i
9:46= 1 comma. So whenever you roll
9:51it will be uh come a animation.
11:23with the things we are going to animate.
11:25So, animations.
11:27Animations.
11:28Uh, perfect.
11:32Now, we can inside of the animations,
11:35we're going to make a frame. We're going
11:38to center it. Like always, use the
11:40plugging scale. scale
11:43and position it to the middle of the
11:45frame by saying 0.5
11:49comma.5
11:51point.
11:53Perfect. We're going to set the size to
11:551 comma 0 comma 1 comma 0. We're going
11:58to make the background color to a dark.
12:02We're going to set the background
12:05transparency to
12:08seven.
12:09We're going to go inside of the screen
12:11UI and press on ignore UI. Okay, I'm not
12:16going to pronounce that, but you can see
12:18we can rename this frame to background.
12:22And inside of inside of the folder,
12:24we're going to put a text label.
12:27Center it like always.
12:32And
12:33there we go.
12:35We can make the background trans
12:37transparency to one. We can make the
12:41text to common.
12:46Make it white.
12:48Change the font to prod one.
12:52And we can also make it slightly bigger.
13:00A little bit smaller maybe.
13:03There we go.
13:05And oh, and we can duplicate this title.
13:09We can duplicate it, put it underneath,
13:13or we're going to drag this uh new text
13:16label inside of the title.
13:20And we're going
15:46and rem put the text label inside of the
15:49text button. Rename the text button to
15:52button. Remove the frame
15:55before we remove the frame. Sorry. Take
15:58the UI corner and UI stroke. Put it
16:00inside of the button. Remove the frame.
16:03Perfect. Now we need to go inside of UI
16:06stroke. Set the border. There we go. Now
16:10it's all done. So local button uh
16:16equals to screen UI wait for child
16:20button. Perfect.
16:23Local debounce. So we're going to set
16:25the debounce debounce. There we go.
16:29Equals to false. We're going to say that
16:32if we click on the uh button,
16:36we're going to connect a function where
16:38we check if the debounce is equal to
16:40false.
16:42Uh if so, we're going to set the
16:45debounce to true and we're going to
16:49say
16:51local rolled uh number equals remotes
16:57dot roll function invoke server. We can
17:01also say print
17:03uh remotes dot roll function invoke
17:07server
17:09and we can say wait one second and
17:12debounce equals to false. So if we go
17:15ahead and test Okay.
18:14Rename the uh local script to
18:18uh
18:21rolling
18:22client.
18:26Then we can rename this main script to
18:29rolling
18:30rolling server.
18:34Perfect. Inside of the rolling client,
18:36we can put a module script.
18:39We can say
18:41animation
18:43animation module.
18:46Inside of here, we can remove this.
18:50We're going to define the twin service.
18:55Twin service.
18:57We're going to define the twin info
18:59which is uh the info is equal to twin
19:02info dot new
19:06uh time 2 seconds uh enm easing style is
19:11sign and enm.ing ing direction is in
19:14out. Perfect.
19:17Now we can make a function
19:21called
19:23animate text.
19:25Okay. So local
19:28uh function animate
19:32animate text equals to oh sorry
19:36inside of parameters we're going to put
19:39text one text two and a rolled number.
19:44Press enter. We're first of all going to
19:48create twin service. Create text one
19:53info
19:55and We are going to change the position
20:00position
20:01to udim new prom scale. Oh,
20:08udim.promcale
20:11sorry.5.
20:14And don't forget to play at the end and
20:17wait 2 seconds. Uh,
20:21perfect. No, we forgot something. We
20:24need to change the position to text one
20:28to
20:30uh position equals UD dim 2 from scale.5
20:35comma 35.
20:38We are going to change the color text
20:42color three to the row number index it
20:47with number three. So we're getting the
20:49third value here which is the color. So
20:52this is the first value, the second and
20:55the third.
20:58So role number three uh text one dot
21:02text equals ro number and index it with
21:06number one. Then the last thing is
21:09setting the text to do text to
21:13uh these symbols
21:17and we're going to say one in and then
21:20curly brackets
21:22rolled number index it with two
21:27and then we're going to say chance and
21:30put
21:33this one again. There we go. Perfect.
21:37Now this is all done. Now we just need
21:39to return
21:43uh
21:44animation or roll animation
21:50roll animation sorry to function index
21:55it with
21:57animation animation folder
22:01and roll the number.
22:04We're going to say local background
22:06equals animation folder. We can make
22:11sure that the script knows that this is
22:14a folder. So colon folder
22:20uh animation folder wait for child uh
22:23background.
22:25We call it background, right? Yeah.
22:28Local title
22:30equals animation folder. Wait for child
22:33title.
22:34And the local rarity equals animation
22:37folder wait for child.
22:40Or we can say is we can Hey,
26:08If we go ahead and play now, hopefully
26:11everything shall work. Don't forget to
26:14join the Discord. Um, perfect. So, if we
26:18go ahead and roll now, we get the
26:21animation. We got rare one in five%
26:24chance like you can see here.
26:28Got her roll again. Everything works
26:32just like it should it should. Perfect.
26:37So, with that being said, please
26:40consider subscribing, liking this video,
26:42join the Discord down in the
26:44description.
26:45Sorry for all the uh scripting I made
26:48you done.
26:52Hopefully, you learned something. And in
26:55the next episode, we're going to make
26:57the tutorial. we're going to make our us
27:00etc.