YouTube2Text

How to make A Pet Simulator X Game on Roblox - Part 7 — Transcript

by polarisprog · 4,545 words · 738 segments · language en · Watch on YouTube

Full transcript

  1. 0:00hello everyone and welcome back to a new
  2. 0:02tutorial on the how to make a person
  3. 0:04letter X Style game series in this video
  4. 0:06I'm going to be showing you how to make
  5. 0:08a data how to fix the data saving system
  6. 0:10and also we are going to be making a
  7. 0:13system for dropping coins when you
  8. 0:15destroy a certain drop and you can also
  9. 0:18collect those coins and it will award
  10. 0:21the player
  11. 0:23also if you guys want to support me and
  12. 0:25want to have access to all of the
  13. 0:27project files including the one you're
  14. 0:28watching right now that will all be
  15. 0:30available on my patreon edit and all
  16. 0:32tier
  17. 0:34okay so what we're going to start with
  18. 0:36is fixing the leader stats bug so as you
  19. 0:40can see right now I have two values
  20. 0:42inside of my leader stats folder but if
  21. 0:44I leave the game and rejoin
  22. 0:48I'll have four
  23. 0:51so I'll check these and as you can see I
  24. 0:54have two coins values and two gem values
  25. 0:57so I'm gonna I'm gonna go ahead and try
  26. 0:59to fix that so just scroll down here and
  27. 1:03what I'm gonna do is check if
  28. 1:06if if true string I is equal equal so
  29. 1:10it's choosing I is equal equal to liter
  30. 1:12stats then what we're going to do is
  31. 1:15um local leader stats
  32. 1:17is equal to and what I'm going to do is
  33. 1:20set this to
  34. 1:23um okay so player dot leader stats
  35. 1:27then we need to get to set this value
  36. 1:31variable up here so value is equal to
  37. 1:33and I'm just going to set it to leader
  38. 1:36stats square brackets uh to C square
  39. 1:40brackets one
  40. 1:42else else we can copy all of this so
  41. 1:46Ctrl X to cut and paste it here
  42. 1:49now that should work
  43. 1:51but the first thing you're going to need
  44. 1:52to do is reset your data store key so
  45. 1:54I'm just going to change this to my data
  46. 1:5721 and I'm going to play the game
  47. 2:03and see if this works
  48. 2:06so I have two liter SAS values and I'm
  49. 2:08going to go here and open an egg so that
  50. 2:12I have less coins and now I'm going to
  51. 2:14leave the game
  52. 2:16rejoin
  53. 2:21and as you can see I should I should
  54. 2:24still have my pet and I have uh two
  55. 2:28values inside of the layer stats folder
  56. 2:31now what I'm gonna do is make the player
  57. 2:33rewarding system so if you destroy drop
  58. 2:37it should drop coins so the first thing
  59. 2:40we're gonna do is add a folder inside of
  60. 2:42the main folder underscore workspace and
  61. 2:44I'm just going to rename it to coin or
  62. 2:48maybe currency drops
  63. 2:51currency drops
  64. 2:53and what I'm gonna do
  65. 2:55and what I'm gonna do is just go to
  66. 2:58the workspace and I'm going to add a
  67. 3:00block and I'm going to change its size
  68. 3:02to one comma one comma one
  69. 3:06and then I'm going to make sure that
  70. 3:08it's transparent so transparency is
  71. 3:11equal to one and I'm going to add a
  72. 3:13billboard gy and I'm going to check
  73. 3:15always on top
  74. 3:17and I'm also going to change its size to
  75. 3:191 comma zero comma one comma zero
  76. 3:22or maybe 1.5 comma 0 comma 1.5 comma
  77. 3:26zero and this should work
  78. 3:30now what I'm going to just add a an
  79. 3:32image label to this
  80. 3:34and I'm going to change its size to 1.
  81. 3:38comma zero comma one comma zero and then
  82. 3:41I'm going to change its image so I'm
  83. 3:43going to go to the toolbox and I'm just
  84. 3:45going to pick a random coin image maybe
  85. 3:47I'll see if I have one inside of my
  86. 3:51uh toolbox okay so I have
  87. 3:55okay I don't have any
  88. 3:58coin images that I can use I'm just
  89. 4:00going to look for a coin in the toolbox
  90. 4:04and I think I'm going to choose this one
  91. 4:08okay I'm gonna use this one and I'm just
  92. 4:11going to check to paste in the image
  93. 4:15so right click and copy asset ID and
  94. 4:19just paste it there
  95. 4:20and now I'm going to make the background
  96. 4:22transparency one
  97. 4:24and yeah that's going to be our coin
  98. 4:26drop and make sure that that Anchorage
  99. 4:28is unchecked so anchor it's unchecked
  100. 4:30and can Collide true
  101. 4:32now I'm going to rename this to coin
  102. 4:34drop
  103. 4:35and what I'm gonna do is put it inside
  104. 4:38of the of replicator storage for now
  105. 4:42actually I'm gonna add a folder and I'm
  106. 4:44going to call it assets
  107. 4:47and I'm just going to add a
  108. 4:51folder called
  109. 4:53currencies currency drops
  110. 4:57and I'm just going to drag the coin drop
  111. 4:59there
  112. 5:00and now what I'm going to do is go to
  113. 5:03start player uh start player script and
  114. 5:06I'm going to add a module script this
  115. 5:08module script will be called currency
  116. 5:11dropper
  117. 5:13so currency
  118. 5:16dropper
  119. 5:20and what I'm gonna do is okay so I'm
  120. 5:24going to have a function in here
  121. 5:25function module
  122. 5:27dot drop
  123. 5:28uh coins or maybe drop currency
  124. 5:32and that's going to take the object that
  125. 5:35that we want to drop so object comma and
  126. 5:38the amount of objects that we want to
  127. 5:41drop and the C frame like the original C
  128. 5:44form that we want this to spawn from and
  129. 5:46so a list of of IDs so I'm just going to
  130. 5:49type in gyds I'll I'll show you what a
  131. 5:53gygi is later but for now I'll just do
  132. 5:56this so this is just a table of ideas
  133. 5:58that we're gonna get
  134. 6:00and then we're going to Loop through
  135. 6:01from so for I is equal to from one to
  136. 6:05the amount
  137. 6:06do and task.spawn function and what I'm
  138. 6:10going to do local drop is equal to and
  139. 6:13object called clone
  140. 6:17and drop the parent is equal to
  141. 6:21workspace dot main folder underscore
  142. 6:23workspace or currency drops
  143. 6:25and local ID is equal to
  144. 6:29instance.new and string value ID dot
  145. 6:33value
  146. 6:35is equal to
  147. 6:37gyds now as I said this is a table so
  148. 6:39we're going to get the index so square
  149. 6:42brackets I
  150. 6:43and
  151. 6:45id.name is equal to
  152. 6:49ID
  153. 6:51and IG dot parent is equal to drop
  154. 6:55and then what I'm going to do is get the
  155. 6:57angle so local angle is equal to I
  156. 7:00multiplied by and brackets math dot Pi
  157. 7:03so math dot pi multiplied by 2 to get
  158. 7:07the uh full circle and we're going to
  159. 7:11divide the whole thing by the amount of
  160. 7:13drops that we're going to get so we're
  161. 7:14gonna get a certain
  162. 7:16angle for each drop
  163. 7:19uh on the radius of the circle and local
  164. 7:22X is equal to
  165. 7:24math.cause and angle and we're going to
  166. 7:28multiply that by five by the way five is
  167. 7:30the radius so how uh so the distance
  168. 7:34between each drop I'm going to have that
  169. 7:37in here so we'll call radius
  170. 7:39is equal to five and I'm just going to
  171. 7:41multiply this by the the radius
  172. 7:44and local Z is equal to and the math
  173. 7:47dots DOT sign this time and angle
  174. 7:51multiplied by the radius now what I'm
  175. 7:55going to do is get the position so look
  176. 7:57up position is equal to and C frame
  177. 8:00multiplied by C frame dot new c-frame
  178. 8:03DOT new
  179. 8:05um X comma zero comma Z
  180. 8:08dot position
  181. 8:11and then we're going to give the
  182. 8:13direction so local direction is equal to
  183. 8:15and position minus C frame
  184. 8:19dot position
  185. 8:22and then we need the fourth circle Force
  186. 8:26now we need a certain Force to push the
  187. 8:28coin upwards so that it spreads all
  188. 8:30around
  189. 8:31so force is equal to the direction
  190. 8:34loss of x to three don't new and math
  191. 8:37dot random from uh minus two to two and
  192. 8:43comma 30. so we're going to put it push
  193. 8:46it up 30 studs
  194. 8:48uh that's not random minus two to two so
  195. 8:53I thought it's a bit randomized now what
  196. 8:55I'm gonna do is drop dot position is
  197. 8:59equal to C frame dot position
  198. 9:03and then drop the assembly
  199. 9:07so assemble linear velocity assembly
  200. 9:10linear velocity is equal to force
  201. 9:13multiplied by drop dot assembly Mass
  202. 9:18now we're going to wait one second so
  203. 9:20that's the right one and
  204. 9:23I'm going to add a value that will allow
  205. 9:25us to color the drop so local can
  206. 9:27collect
  207. 9:28is equal to
  208. 9:30instance.new string value
  209. 9:34strength value and can collect dot names
  210. 9:37equals you can collect and can collect
  211. 9:41stop parent is equal to the drop itself
  212. 9:45and then okay so we are done with our uh
  213. 9:49drop currency thing now what I'm gonna
  214. 9:51do is call this is find when we should
  215. 9:55call this function
  216. 9:56okay so what I'm gonna do is go to
  217. 10:00view workspace okay so selection Swap
  218. 10:04and I'm going to go to the plus icon and
  219. 10:06I'm going to search for award actually
  220. 10:09sorry I'm going to search for end value
  221. 10:11and this is just going to be how much
  222. 10:13we're gonna how much we're gonna award
  223. 10:16the player for destroying this drop I'm
  224. 10:19going to set it to 100 coins
  225. 10:22and I'm just going to rename it to coin
  226. 10:26value or maybe coin Awards
  227. 10:31and I'm just going to paste it inside of
  228. 10:34this one too okay so red drop
  229. 10:37I'm just going to do the same thing and
  230. 10:39what I'm going to do now is add is go to
  231. 10:42okay I'm gonna go to the main client
  232. 10:46script and in here when we destroy the
  233. 10:49drop what I'm going to do is fire a
  234. 10:51remote event so
  235. 10:53uh I'm going to add a remote and I'm
  236. 10:55going to call it
  237. 10:57okay I'm going to call it Awards on
  238. 11:00Destroy Okay so
  239. 11:01add a remote event and I'm going to call
  240. 11:04it where is it
  241. 11:05where is it okay why don't you call it
  242. 11:07award
  243. 11:09on Destroy
  244. 11:12and then what I'm gonna do here is just
  245. 11:14do uh remotes dot fire actually dot
  246. 11:18award on Destroy called fire client on
  247. 11:22fire server sorry
  248. 11:23and that's just going to take the drop
  249. 11:27the jobs name so maybe drop
  250. 11:31dot name
  251. 11:32okay so drop.name and what I'm going to
  252. 11:35do next is just go to the okay so where
  253. 11:39is the main server script the one I'm
  254. 11:42gonna do is
  255. 11:43game don't replicator storage don't
  256. 11:45remote stop uh word under on destroyed
  257. 11:49on server in the on server event command
  258. 11:53connect function actually I'm sorry we
  259. 11:55need to make this a remote function I'm
  260. 11:58really sorry about that
  261. 12:00so just add the remote function here
  262. 12:02remote function and just call it same
  263. 12:04thing award Awards on Destroy
  264. 12:09and I'm just going to go back here and
  265. 12:11I'm going to do the okay so local result
  266. 12:15local result is equal to remotes don't
  267. 12:18we don't destroy from fire server called
  268. 12:21invoke server invoke server and that
  269. 12:23should work now go back to your main
  270. 12:25client scripts and make game the
  271. 12:27replicated storage.remotes.org
  272. 12:30on destroyed don't server info is equal
  273. 12:33to function that's going to take the
  274. 12:35player
  275. 12:37and the object or the um drop name
  276. 12:42and DC frame solo and the CF
  277. 12:46okay so object C frame
  278. 12:49or actually actually yes
  279. 12:54Okay so
  280. 12:56yeah I'm gonna do that
  281. 12:58okay so what I'm gonna do actually I'm
  282. 13:01not going to get this C frame
  283. 13:04okay so local
  284. 13:08okay so local drop
  285. 13:10what I'm going to do is check if the
  286. 13:12player actually has the area in which
  287. 13:16the drop is contained so
  288. 13:19what I'm going to do is check if
  289. 13:22layer
  290. 13:25if player don't
  291. 13:27areas
  292. 13:30okay so we have a an area's thing so if
  293. 13:34blow the areas gonna find first child
  294. 13:39uh drop area
  295. 13:42then
  296. 13:43we're going to continue but we need to
  297. 13:45set this variable so local drop area is
  298. 13:47equal to nil and we're going to set this
  299. 13:50drop area so for underscore come again
  300. 13:53pairs workspace
  301. 13:55impairs main folder underscore workspace
  302. 13:57Dot
  303. 13:59drops come and get children do
  304. 14:04for underscore comma drop
  305. 14:06actually this V should be renamed to
  306. 14:08area for underscore command drop
  307. 14:10and pairs area
  308. 14:12come and get children
  309. 14:14do
  310. 14:16and what I'm gonna do is just check if
  311. 14:21drop.name is equal to drop name
  312. 14:24and then and drop area
  313. 14:28is equal to area dot name
  314. 14:33okay so this should okay this should
  315. 14:37work now I'm just going to check if drop
  316. 14:40area then
  317. 14:43we're gonna check if the player actually
  318. 14:45owns the area
  319. 14:47and then we are going to generate some
  320. 14:49guids okay
  321. 14:51so what I'm gonna do is just create the
  322. 14:54table for the gyd so I'll call gy this
  323. 14:56is equal to and I'm stable
  324. 14:59and now we need to get the actual drop
  325. 15:03so local drop
  326. 15:06is equal to nil and after setting this
  327. 15:09drop is equal to
  328. 15:11drop and actually this should be V let
  329. 15:15me change this to V
  330. 15:19okay and this should be dropped area
  331. 15:22so just do this
  332. 15:23and now I'm going to change okay and
  333. 15:26then we're gonna break break this now
  334. 15:29what I'm going to do is local
  335. 15:31um
  336. 15:32coin award is equal to drop dot coin
  337. 15:37award dot value so coin Awards
  338. 15:40dot value
  339. 15:43now what we're going to do is go back
  340. 15:44here and on the surfaces and all the
  341. 15:47surfaces in here when I get HTTP service
  342. 15:49HTTP service
  343. 15:51is equal to gamecom get service HTTP
  344. 15:54service and then I'm going to scroll
  345. 15:56down
  346. 15:57and in the guidance here what we're
  347. 16:00going to do is generate so we want to
  348. 16:03spawn five different coins
  349. 16:05so for I is equal to five from one to
  350. 16:09five do
  351. 16:11and local guid is equal to http service
  352. 16:15call generate gyd and just
  353. 16:19we don't need to wrap this in curly
  354. 16:21braces so just false
  355. 16:24and table dot inserts
  356. 16:27gyd's comma uh gyd so gyd command g y d
  357. 16:33not gyd is comma gyds okay now what we
  358. 16:37need to do after inserting that what I'm
  359. 16:39going to do is just
  360. 16:42okay
  361. 16:44so I'm gonna go up here and I'm going to
  362. 16:47create a table
  363. 16:49it's going to be cold
  364. 16:52uh coin drops
  365. 16:55and it's going to be equal to an empty
  366. 16:57table
  367. 16:59and
  368. 17:02on the player added event what we're
  369. 17:04gonna do is just okay so if not
  370. 17:08coin drops square brackets player then
  371. 17:11coin drops square brackets player is
  372. 17:14equal to a table
  373. 17:16and now I'm going to scroll down here
  374. 17:19and okay
  375. 17:22so
  376. 17:23I'm going to look through the gyds for I
  377. 17:26can't be in pairs gyds do
  378. 17:29and tabletop insert table dot inserts
  379. 17:34uh gem drops gem drops I mean coin drops
  380. 17:38coin drop coin what am I doing coin
  381. 17:40award
  382. 17:42what
  383. 17:43coin drops
  384. 17:45on drops square brackets a player comma
  385. 17:49V
  386. 17:51now what we need to do is
  387. 17:54just return true okay
  388. 17:59actually we are going to return the okay
  389. 18:01so we're going to return
  390. 18:05hmm okay I'm going to return
  391. 18:10true
  392. 18:13yeah that's it I'm just gonna return
  393. 18:14true
  394. 18:15and I'm going to fire a remote
  395. 18:19uh called
  396. 18:21drop coins so I'm going to go to the
  397. 18:24remotes folder
  398. 18:28uh where is it
  399. 18:30remote and I'm going to add a remote
  400. 18:32event
  401. 18:33called drop
  402. 18:35coins
  403. 18:38now what I'm gonna do is just
  404. 18:40in here uh remotes games or replicator
  405. 18:44store again storage don't remote stop
  406. 18:46drop coins calling five clients that's
  407. 18:49going to take the player
  408. 18:51uh object c times object CF
  409. 18:55comma and dg1 these list and in here
  410. 18:59we're also going to send the of the
  411. 19:01object
  412. 19:03CEF
  413. 19:05and I'm going to go back here to the
  414. 19:07main client and when we send this we're
  415. 19:09going to send drop dot uh primary part
  416. 19:13primary part
  417. 19:15C frame
  418. 19:17now we're going to go back to the main
  419. 19:19server okay so this looks good
  420. 19:22so what I'm going to do next is just go
  421. 19:25back to my main client script
  422. 19:30okay so go back
  423. 19:33to the main client script and what I'm
  424. 19:36going to do is remotes dot dropcoins
  425. 19:38don't answer online event connect
  426. 19:40function and it's going to take the C
  427. 19:44frame comma gyds
  428. 19:48and then I'm just going to go up here
  429. 19:50and just do local uh currency
  430. 19:53dropper it's equal to require
  431. 19:58and just a layer
  432. 20:01okay where is it where is it
  433. 20:06script.parent dot currency dropper
  434. 20:09script.parents can't wait for child
  435. 20:11currency dropper and currency dropper
  436. 20:15or drop currency and that's going to
  437. 20:17take uh replicated storage dot assets
  438. 20:21not currency drops dot coin drop comma
  439. 20:25and that's also going to take
  440. 20:27the
  441. 20:30number that we want to spawn so five
  442. 20:32comma C frame plus Vector three dot new
  443. 20:35zero comma four comma zero so we're
  444. 20:38gonna spawn the coins a bit up
  445. 20:42by four studs and we're also going to
  446. 20:44send the gyds
  447. 20:46okay so this should work so I'm gonna go
  448. 20:49ahead and play the game
  449. 20:51see if this works
  450. 20:53all right so I'm just going to go ahead
  451. 20:55and equip my pet
  452. 20:58I'm gonna equip my pet and I'm just
  453. 21:01going to just send it over to the red
  454. 21:04drop
  455. 21:05and I do not have my area's value so I'm
  456. 21:09just going to buy the area number two
  457. 21:13and then I'm gonna go okay so I bought
  458. 21:16area one now this should be an area one
  459. 21:20I'm gonna check
  460. 21:21drops area one okay so this one is in
  461. 21:24area one so I'm going to click this
  462. 21:27wait for it to destroy and we're gonna
  463. 21:29see what happens
  464. 21:32as you can see nothing happens which
  465. 21:34means we got an error
  466. 21:36so uh going Awards don't vow okay so
  467. 21:40coin Awards is equal to Value not
  468. 21:43validity
  469. 21:44no I'm gonna play the game again and see
  470. 21:47if this works
  471. 21:49okay so this still doesn't work it says
  472. 21:52server script service then index nail
  473. 21:54with coin Awards so coin Awards is not
  474. 21:59a thing
  475. 22:01hmm
  476. 22:03so coin award
  477. 22:05drop dot coin Awards
  478. 22:11okay so I think this
  479. 22:15should work and I think the problem is
  480. 22:17we don't have the actual drop here
  481. 22:21so I think that's why this is happening
  482. 22:24and that's oh that's why this should be
  483. 22:27drop is equal to V
  484. 22:28and everything should work fine now
  485. 22:33okay so I'm gonna join the game
  486. 22:35uh by the first area why does it not
  487. 22:39play between though okay that's weird
  488. 22:41I'm not I could equip a pet and I'm
  489. 22:44going to destroy this one
  490. 22:48and it destroys it and it spawns the
  491. 22:52coins
  492. 22:54okay
  493. 22:57so they do spawn
  494. 22:59now what I'm gonna do is make a system
  495. 23:01for collecting the drones
  496. 23:06okay so to do that it's very easy we are
  497. 23:09just going to add a moduscript
  498. 23:13here
  499. 23:15or maybe you can just do it in the main
  500. 23:16client script I'm just going to do okay
  501. 23:19so
  502. 23:21uh my service dot heartbeat okay I'm
  503. 23:23gonna do it in here
  504. 23:26okay so we're gonna we're gonna need to
  505. 23:29get the
  506. 23:32actually
  507. 23:33okay I'm just gonna do it in here on
  508. 23:35service dot run dot render steps come on
  509. 23:39connect function
  510. 23:40and we're gonna need
  511. 23:43two variables we're gonna need the okay
  512. 23:47so local rebound stable or DB is equal
  513. 23:51to an empty table and local distance
  514. 23:52from which we can collect so distance is
  515. 23:55equal to 12. so 12 starts away and what
  516. 23:59I'm going to do in here is get the
  517. 24:00player's character so local character
  518. 24:03is equal to player.character or player
  519. 24:05dot character round that's going away
  520. 24:07and we're going to check if the
  521. 24:08character is there then so if it is
  522. 24:10there then when I Loop through all the
  523. 24:13currency drops so for underscore come
  524. 24:14with the in pairs main folder okay so
  525. 24:17workspace dot main folder or workspace
  526. 24:20won't wait for child demand folder on
  527. 24:21the school workspace going to wait for
  528. 24:23you to wait for child currency drops
  529. 24:25don't get children do and if V Dot if
  530. 24:30square brackets feed off position so the
  531. 24:33V Dot position minus character dot
  532. 24:37primary part
  533. 24:39stop position
  534. 24:43dot magnitude
  535. 24:45dot magnitude by the way we'll do this
  536. 24:48outside of the brackets is less or equal
  537. 24:51to the distance then
  538. 24:54actually and the confined first child uh
  539. 24:58can collect
  540. 25:00then
  541. 25:02the line cards dot anchored
  542. 25:05is equal to True
  543. 25:08um between service call create
  544. 25:11oncreate a v comma between info dot new
  545. 25:160.2
  546. 25:18and comma square brackets I mean curly
  547. 25:21brackets C frame is equal to
  548. 25:24character
  549. 25:26don't humanoid report dot C frame
  550. 25:31character's not humanoid part C frames
  551. 25:33column play
  552. 25:34and then what we need to do is just
  553. 25:37check okay so if
  554. 25:40then um
  555. 25:43way so we check that and then
  556. 25:47okay
  557. 25:50so after doing that we are also going to
  558. 25:53check if the dot position
  559. 25:57minus character dot primary
  560. 26:00part.position
  561. 26:02dot magnitude is less or equal than
  562. 26:05three then
  563. 26:09uh if not square brackets the bounce
  564. 26:14if not ZB
  565. 26:15okay so if not DB square brackets V then
  566. 26:20DB score back as V is equal to true and
  567. 26:24if okay so I'm just going to uh
  568. 26:28remote stop give
  569. 26:30I'm going to add a remote event in here
  570. 26:32I'm going to rename it to give coins
  571. 26:35and remote stop give coins call on fire
  572. 26:38server
  573. 26:40and that's going to take the video ID
  574. 26:43default value
  575. 26:45and then what we're going to do is okay
  576. 26:49so V Dot ID dot value
  577. 26:52hmm if you don't like you don't value
  578. 26:56and we will wait five seconds so that's
  579. 26:59got wait five seconds
  580. 27:01and DB square brackets V is equal to nil
  581. 27:05and
  582. 27:07the con destroy
  583. 27:10when it gets that close we're gonna
  584. 27:11destroy it
  585. 27:14so now I'm going to play the game and
  586. 27:16just hope that this is gonna work
  587. 27:19now it's not going to give us coins yet
  588. 27:22but I just want to see if the collection
  589. 27:23will work
  590. 27:24why did the why did this just disappear
  591. 27:27oh it's because I it's because I own it
  592. 27:31okay so I'm just going to send this here
  593. 27:34and I'm going to get away
  594. 27:36let's see this is gonna work it drops
  595. 27:38the coins if I get close to them
  596. 27:40that I can collect them okay great but
  597. 27:43now I think that they're okay so now I
  598. 27:46wanted to give the player the coin so
  599. 27:48main service main server
  600. 27:51and game.replicator storage dot remote
  601. 27:56server event contact function layer
  602. 28:01and what we need to do now is just go
  603. 28:04here okay so I'm just gonna think about
  604. 28:07this
  605. 28:08okay if table don't find
  606. 28:11uh coin drops square brackets player
  607. 28:15comma gyd
  608. 28:18no actually this is going to take the
  609. 28:20letter and the gyd
  610. 28:22then
  611. 28:23I'm also going to go back
  612. 28:27um where is it
  613. 28:29so on the main clients we do send the ID
  614. 28:32okay so gyd then a player
  615. 28:36dot stats
  616. 28:39dot coins dot value
  617. 28:43plus equal to the amount now we're going
  618. 28:45to get this amount shortly but for now
  619. 28:47it's just going to be one and then table
  620. 28:49don't remove
  621. 28:51uh coin drops square brackets uh player
  622. 28:55comma table dot find uh coin drops
  623. 28:59square brackets player comma gyd
  624. 29:04just make sure you're doing it correctly
  625. 29:05now I'm going to think of a way to get
  626. 29:07the amount
  627. 29:08but I'm just going to play the game for
  628. 29:10now and see this is going to give me
  629. 29:12coins
  630. 29:13okay so if I equip my pet
  631. 29:18and just send it here
  632. 29:21just stand there
  633. 29:24and if I go ahead and collect my coins
  634. 29:27I do not get anything
  635. 29:29oh
  636. 29:32I'm sorry uh changes to layer stats
  637. 29:34later
  638. 29:36stats
  639. 29:38play the game again
  640. 29:40okay so it's almost destroyed it's
  641. 29:43destroyed now which should okay so it
  642. 29:45does give me coins now and it's secure
  643. 29:48but now we need to figure out a way to
  644. 29:49get the amount
  645. 29:52okay so I got it working and the way
  646. 29:54this is by okay so in here when we are
  647. 29:58looking through the zyds I changed so
  648. 30:01coin drop square brackets player score
  649. 30:03brackets V is equal to an empty table
  650. 30:05and inside of that table we are creating
  651. 30:08this Awards uh thing and we are variable
  652. 30:11and we are setting it to uh meth.round
  653. 30:15coin award divided by five so just to
  654. 30:17add these two lines of code and now down
  655. 30:20here I'm checking if coin drop score
  656. 30:22back it's player
  657. 30:24and we find the gyd in there then we are
  658. 30:28adding up to the players coins values
  659. 30:31uh so coin drops go back his player
  660. 30:34score brackets gyd square brackets
  661. 30:36towards so we are adding that value
  662. 30:39and we are just removing that from the
  663. 30:42table so just copy this and paste it in
  664. 30:44and it should work just fine so if I
  665. 30:48just wait for my pets to load in
  666. 30:52um equip it and I'm just going to send
  667. 30:54my pet there
  668. 30:56this should work
  669. 30:59I'm just going to wait for this and it
  670. 31:02does work so I'm just going to collect
  671. 31:04these
  672. 31:05and as you can see they do give me quite
  673. 31:07a lot of coins and that is because
  674. 31:10um
  675. 31:11it's 100 divided by five so each coin is
  676. 31:13worth that value now what I'm gonna do
  677. 31:16is just close all these and I'm just
  678. 31:19going to put this one inside of the
  679. 31:22first area too
  680. 31:26and now what we need to do is get rid of
  681. 31:28the area 2 folder
  682. 31:31and now when we are I want to see if we
  683. 31:35can still send the pads
  684. 31:38if we can still do that then we need to
  685. 31:41fix it because we should only be able to
  686. 31:43send the pads to the areas that we have
  687. 31:47oh actually I can do that but I'm gonna
  688. 31:51check what will happen if I remove my
  689. 31:54area one value
  690. 31:58and we can still attack it so we're
  691. 32:00gonna have to fix that
  692. 32:01it's very simple we just enter our
  693. 32:06um where is it
  694. 32:09I think I have another main server
  695. 32:11script
  696. 32:13okay right here on the main server
  697. 32:15script what we should do is check if
  698. 32:19Okay so
  699. 32:21if
  700. 32:23layer
  701. 32:24dot areas confine first child
  702. 32:29first child
  703. 32:32um drop
  704. 32:34stop parents
  705. 32:36okay so if player
  706. 32:40okay where is this so drop
  707. 32:44dot parent
  708. 32:46dot name then then we're going to do all
  709. 32:50this
  710. 32:52if not then nothing's gonna happen
  711. 32:55okay so now what I'm gonna do is add a
  712. 32:58default area to my areas value so I'm
  713. 33:01just going to add in a
  714. 33:04string value is just going to be renamed
  715. 33:06to area one
  716. 33:09and this is going to be named area
  717. 33:13actually this is going to be renamed to
  718. 33:15area 0.
  719. 33:17so the default area is the area zero
  720. 33:21and the these two should be in the area
  721. 33:24zero
  722. 33:30okay
  723. 33:31now this should work
  724. 33:41okay so drops area zero I should have
  725. 33:44area zero so I should be able to
  726. 33:48do that
  727. 33:50so I should be able to attack them both
  728. 33:52of them
  729. 33:54but if I just go ahead and change this
  730. 33:58name this parent's name to Ariel one
  731. 34:02and then I should not be able to attack
  732. 34:04it so as you can see nothing happens
  733. 34:07I'm just going to leave the game now and
  734. 34:10yeah that's going to be it for today's
  735. 34:11tutorial if this helps make sure to
  736. 34:13subscribe like the video share it with
  737. 34:15your friends and I'll see you all in the
  738. 34:17next video bye

About this transcript

This page contains the full transcript of How to make A Pet Simulator X Game on Roblox - Part 7 by polarisprog, generated from the public captions YouTube serves with the video. The transcript has 4,545 words across 738 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.