Advertisement
KrYn0MoRe

book script v1.5

Aug 16th, 2020 (edited)
3,646
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 18.38 KB | None | 0 0
  1. local bookdata = {
  2.     ['pages'] = {
  3.         ['1'] = {
  4.             ['desc'] = [[  
  5. Creeper,
  6. Aw man!    
  7.             ]],
  8.         },
  9.         ['2'] = {
  10.             ['desc'] = [[
  11. So we back in the mine
  12. Got our pickaxe swinging from side to side
  13. Side-side to side
  14. This task, a grueling one
  15. Hope to find some diamonds tonight, night, night
  16. Diamonds tonight
  17.             ]],
  18.         },
  19.         ['3'] = {
  20.             ['desc'] = [[
  21. Heads up
  22. You hear a sound, turn around and look up
  23. Total shock fills your body
  24. Oh, no, it's you again
  25. I can never forget those eyes, eyes, eyes
  26. Eyes-eye-eyes
  27.             ]],
  28.         },
  29.         ['4'] = {
  30.             ['desc'] = [[
  31. 'Cause, baby, tonight
  32. The creeper's tryna steal all our stuff again
  33. 'Cause, baby, tonight
  34. You grab your pick, shovel, and bolt again (Bolt again-gain)
  35. And run, run until it's done, done
  36. Until the sun comes up in the morn'
  37. 'Cause, baby, tonight
  38. The creeper's tryna steal all our stuff again (Stuff again-gain)
  39.             ]],
  40.         },
  41.         ['5'] = {
  42.             ['desc'] = [[
  43. Just when you think you're safe
  44. Overhear some hissing from right behind
  45. Right-right behind
  46. That's a nice life you have
  47. Shame it's gotta end at this time, time, time
  48. Time-time-time-time
  49.             ]]
  50.         },
  51.         ['6'] = {
  52.             ['desc'] = [[
  53. Blows up
  54. Then your health bar drops and you could use a one-up
  55. Get inside, don't be tardy
  56. So, now you're stuck in there
  57. Half a heart is left, but don't die, die, die
  58. Die-die-die
  59.             ]]
  60.         },
  61.         ['7'] = {
  62.             ['desc'] = [[
  63. 'Cause, baby, tonight
  64. The creeper's tryna steal all our stuff again
  65. 'Cause, baby, tonight
  66. You grab your pick, shovel, and bolt again (Bolt again-gain)
  67. And run, run until it's done, done
  68. Until the sun comes up in the morn'
  69. 'Cause, baby, tonight
  70. The creeper's tryna steal all our stuff again
  71.             ]]
  72.         },
  73.         ['8'] = {
  74.             ['desc'] = [[
  75. (Creepers, you're mine, haha)
  76. Dig up diamonds and craft those diamonds
  77. And make some armor, get it, baby
  78. Go and forge that like you so MLG pro
  79. The sword's made of diamonds, so come at me, bro, huh
  80. Training in your room under the torchlight
  81. Hone that form to get you ready for the big fight
  82. Every single day and the whole night
  83. Creeper's out prowlin', hoo, alright
  84. Look at me, look at you
  85. Take my revenge, that's what I'm gonna do
  86. I'm a warrior, baby, what else is new?
  87. And my blade's gonna tear through you, bring it
  88.             ]]
  89.         },
  90.         ['9'] = {
  91.             ['desc'] = [[
  92. 'Cause, baby, tonight
  93. The creeper's tryna steal all our stuff again
  94. (Gather your stuff, yeah, let's take back the world)
  95. Yeah, baby, tonight (Haha)
  96. Grab your sword, armor and go (It's on)
  97. Take your revenge (Woo), oh-oh, oh-oh
  98. So fight, fight, like it's the last, last night
  99. Of your life, life, show them your bite (Woo)
  100.             ]]
  101.         },
  102.         ['10'] = {
  103.             ['desc'] = [[
  104. - Book script made by AlmightyToast
  105.             ]]
  106.         },
  107.     }
  108. }
  109.    
  110. local plr = owner
  111. local char = plr.Character
  112. local hum = char:FindFirstChildOfClass("Humanoid")
  113. local torso = char:FindFirstChild("Torso") or char:FindFirstChild("HumanoidRootPart")
  114.    
  115. tool = Instance.new("Tool")
  116. book = Instance.new("Part")
  117. Part2 = Instance.new("Part")
  118. Part3 = Instance.new("Part")
  119. Part4 = Instance.new("Part")
  120. Part5 = Instance.new("Part")
  121. Part6 = Instance.new("Part")
  122. tool.Name = "Book"
  123. tool.Parent = nil
  124. tool.ToolTip = 'makes you wiser than ever!'
  125. book.Name = "Handle"
  126. book.Parent = tool
  127. book.CFrame = CFrame.new(-13.1719999, 2.09956455, 5.24839497, 6.2584877e-07, 2.63005495e-06, 0.999993324, -5.36441803e-07, 0.999998331, -8.41915607e-07, -0.999998868, -5.06639481e-07, 1.19954348e-06)
  128. book.Position = Vector3.new(-13.1719999, 2.09956455, 5.24839497)
  129. book.Rotation = Vector3.new(60, 120, -76.6100006)
  130. book.Transparency = 1
  131. book.Size = Vector3.new(0.108625151, 0.108625151, 0.108625151)
  132. book.Anchored = true
  133. book.CanCollide = false
  134. book.Locked = true
  135. book.FormFactor = Enum.FormFactor.Custom
  136. book.formFactor = Enum.FormFactor.Custom
  137. Part2.Name = "Part5"
  138. Part2.Parent = tool
  139. Part2.CFrame = CFrame.new(-13.7622576, 2.30439925, 5.25151014, -0.965916216, -0.25881958, -5.22307346e-07, 0.258819044, -0.965923488, 4.99910243e-07, -1.40120244e-06, 2.10539554e-07, 0.999998331)
  140. Part2.Orientation = Vector3.new(0, 0, 165)
  141. Part2.Position = Vector3.new(-13.7622576, 2.30439925, 5.25151014)
  142. Part2.Rotation = Vector3.new(0, 0, 165)
  143. Part2.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  144. Part2.Size = Vector3.new(1.34695184, 0.108625151, 0.217250243)
  145. Part2.Anchored = true
  146. Part2.BottomSurface = Enum.SurfaceType.Smooth
  147. Part2.BrickColor = BrickColor.new("Really black")
  148. Part2.CanCollide = false
  149. Part2.Locked = true
  150. Part2.Material = Enum.Material.SmoothPlastic
  151. Part2.TopSurface = Enum.SurfaceType.Smooth
  152. Part2.brickColor = BrickColor.new("Really black")
  153. Part2.FormFactor = Enum.FormFactor.Custom
  154. Part2.formFactor = Enum.FormFactor.Custom
  155. Part3.Name = "Part1"
  156. Part3.Parent = tool
  157. Part3.CFrame = CFrame.new(-13.7153044, 2.50101781, 4.78722715, -0.965916455, -0.235397115, -0.107590772, 0.258819044, -0.878511131, -0.401530236, -1.37912787e-06, -0.41569525, 0.909502149)
  158. Part3.Orientation = Vector3.new(23.6700001, -6.75, 163.580002)
  159. Part3.Position = Vector3.new(-13.7153044, 2.50101781, 4.78722715)
  160. Part3.Rotation = Vector3.new(23.8199997, -6.17999983, 166.300003)
  161. Part3.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  162. Part3.Size = Vector3.new(1.3252275, 0.108625151, 0.983057618)
  163. Part3.Anchored = true
  164. Part3.BottomSurface = Enum.SurfaceType.Smooth
  165. Part3.BrickColor = BrickColor.new("Really black")
  166. Part3.CanCollide = false
  167. Part3.Locked = true
  168. Part3.Material = Enum.Material.SmoothPlastic
  169. Part3.TopSurface = Enum.SurfaceType.Smooth
  170. Part3.brickColor = BrickColor.new("Really black")
  171. Part3.FormFactor = Enum.FormFactor.Custom
  172. Part3.formFactor = Enum.FormFactor.Custom
  173. Part4.Name = "Part2"
  174. Part4.Parent = tool
  175. Part4.CFrame = CFrame.new(-13.7048597, 2.49804521, 5.7262578, 0.965925097, -0.235399812, -0.107589893, -0.258821666, -0.878512025, -0.401532084, 1.56551744e-06, 0.415696561, -0.9095034)
  176. Part4.Orientation = Vector3.new(23.6700001, -173.25, -163.580002)
  177. Part4.Position = Vector3.new(-13.7048597, 2.49804521, 5.7262578)
  178. Part4.Rotation = Vector3.new(156.179993, -6.17999983, 13.6999998)
  179. Part4.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  180. Part4.Size = Vector3.new(1.3252275, 0.108625151, 0.983057618)
  181. Part4.Anchored = true
  182. Part4.BottomSurface = Enum.SurfaceType.Smooth
  183. Part4.BrickColor = BrickColor.new("Really black")
  184. Part4.CanCollide = false
  185. Part4.Locked = true
  186. Part4.Material = Enum.Material.SmoothPlastic
  187. Part4.TopSurface = Enum.SurfaceType.Smooth
  188. Part4.brickColor = BrickColor.new("Really black")
  189. Part4.FormFactor = Enum.FormFactor.Custom
  190. Part4.formFactor = Enum.FormFactor.Custom
  191. Part5.Name = "Part3"
  192. Part5.Parent = tool
  193. Part5.CFrame = CFrame.new(-13.6972809, 2.56853485, 4.84714222, -0.965918183, -0.23539257, -0.107585192, 0.258812577, -0.878511608, -0.401533484, 2.40758618e-06, -0.415696919, 0.909501374)
  194. Part5.Orientation = Vector3.new(23.6700001, -6.75, 163.580002)
  195. Part5.Position = Vector3.new(-13.6972809, 2.56853485, 4.84714222)
  196. Part5.Rotation = Vector3.new(23.8199997, -6.17999983, 166.300003)
  197. Part5.Color = Color3.new(0.972549, 0.972549, 0.972549)
  198. Part5.Size = Vector3.new(1.28177738, 0.0869001225, 0.939607441)
  199. Part5.Anchored = true
  200. Part5.BottomSurface = Enum.SurfaceType.Smooth
  201. Part5.BrickColor = BrickColor.new("Institutional white")
  202. Part5.CanCollide = false
  203. Part5.Locked = true
  204. Part5.Material = Enum.Material.SmoothPlastic
  205. Part5.TopSurface = Enum.SurfaceType.Smooth
  206. Part5.brickColor = BrickColor.new("Institutional white")
  207. Part5.FormFactor = Enum.FormFactor.Custom
  208. Part5.formFactor = Enum.FormFactor.Custom
  209. Part6.Name = "Part4"
  210. Part6.Parent = tool
  211. Part6.CFrame = CFrame.new(-13.6974564, 2.56735682, 5.66411972, 0.965925157, -0.235399514, -0.107590035, -0.258821458, -0.878511846, -0.40153265, 1.48187451e-06, 0.415697128, -0.909503162)
  212. Part6.Orientation = Vector3.new(23.6700001, -173.25, -163.580002)
  213. Part6.Position = Vector3.new(-13.6974564, 2.56735682, 5.66411972)
  214. Part6.Rotation = Vector3.new(156.179993, -6.17999983, 13.6999998)
  215. Part6.Color = Color3.new(0.972549, 0.972549, 0.972549)
  216. Part6.Size = Vector3.new(1.28177738, 0.0869000927, 0.945038676)
  217. Part6.Anchored = true
  218. Part6.BottomSurface = Enum.SurfaceType.Smooth
  219. Part6.BrickColor = BrickColor.new("Institutional white")
  220. Part6.CanCollide = false
  221. Part6.Locked = true
  222. Part6.Material = Enum.Material.SmoothPlastic
  223. Part6.TopSurface = Enum.SurfaceType.Smooth
  224. Part6.brickColor = BrickColor.new("Institutional white")
  225. Part6.FormFactor = Enum.FormFactor.Custom
  226. Part6.formFactor = Enum.FormFactor.Custom
  227.  
  228. ScreenGui0 = Instance.new("ScreenGui")
  229. Frame1 = Instance.new("Frame")
  230. TextLabel2 = Instance.new("TextBox")
  231. ImageLabel3 = Instance.new("ImageLabel")
  232. TextButton4 = Instance.new("TextButton")
  233. ImageLabel5 = Instance.new("ImageLabel")
  234. TextButton6 = Instance.new("TextButton")
  235. ImageLabel7 = Instance.new("ImageLabel")
  236. TextLabel8 = Instance.new("TextBox")
  237. ImageLabel9 = Instance.new("ImageLabel")
  238. ScreenGui0.Parent = nil
  239. Frame1.Parent = ScreenGui0
  240. Frame1.Position = UDim2.new(0.321320087, 0, 0.104199089, 0)
  241. Frame1.Size = UDim2.new(0.357237846, 0, 0.790824234, 0)
  242. Frame1.BackgroundColor = BrickColor.new("Institutional white")
  243. Frame1.BackgroundColor3 = Color3.new(1, 1, 1)
  244. Frame1.BackgroundTransparency = 1
  245. Frame1.BorderSizePixel = 0
  246. TextLabel2.Name = "page"
  247. TextLabel2.Parent = Frame1
  248. TextLabel2.Position = UDim2.new(0.0299706142, 0, 0.941986382, 0)
  249. TextLabel2.Size = UDim2.new(0.941077292, 0, 0.0577489771, 0)
  250. TextLabel2.BackgroundColor = BrickColor.new("Dark grey metallic")
  251. TextLabel2.BackgroundColor3 = Color3.new(0.329412, 0.329412, 0.329412)
  252. TextLabel2.BackgroundTransparency = 1
  253. TextLabel2.BorderSizePixel = 0
  254. TextLabel2.ZIndex = 4
  255. TextLabel2.Font = Enum.Font.SourceSans
  256. TextLabel2.FontSize = Enum.FontSize.Size14
  257. TextLabel2.Text = "Page: I"
  258. TextLabel2.TextColor = BrickColor.new("Institutional white")
  259. TextLabel2.TextColor3 = Color3.new(1, 1, 1)
  260. TextLabel2.TextScaled = true
  261. TextLabel2.TextSize = 14
  262. TextLabel2.TextStrokeTransparency = 0
  263. TextLabel2.TextWrap = true
  264. TextLabel2.TextWrapped = true
  265. ImageLabel3.Name = "page_Roundify_12px"
  266. ImageLabel3.Parent = TextLabel2
  267. ImageLabel3.Position = UDim2.new(0.5, 0, 0.5, 0)
  268. ImageLabel3.Size = UDim2.new(1, 0, 1, 0)
  269. ImageLabel3.AnchorPoint = Vector2.new(0.5, 0.5)
  270. ImageLabel3.BackgroundColor = BrickColor.new("Institutional white")
  271. ImageLabel3.BackgroundColor3 = Color3.new(1, 1, 1)
  272. ImageLabel3.BackgroundTransparency = 1
  273. ImageLabel3.ZIndex = 3
  274. ImageLabel3.Image = "rbxassetid://3570695787"
  275. ImageLabel3.ImageColor3 = Color3.new(0.329412, 0.329412, 0.329412)
  276. ImageLabel3.ScaleType = Enum.ScaleType.Slice
  277. ImageLabel3.SliceCenter = Rect.new(100, 100, 100, 100)
  278. TextButton4.Name = "backward"
  279. TextButton4.Parent = Frame1
  280. TextButton4.Position = UDim2.new(0, 0, 0.941986382, 0)
  281. TextButton4.Size = UDim2.new(0.0799216405, 0, 0.0577489771, 0)
  282. TextButton4.BackgroundColor = BrickColor.new("Really black")
  283. TextButton4.BackgroundColor3 = Color3.new(0, 0, 0)
  284. TextButton4.BackgroundTransparency = 1
  285. TextButton4.BorderColor = BrickColor.new("Really black")
  286. TextButton4.BorderColor3 = Color3.new(0, 0, 0)
  287. TextButton4.BorderSizePixel = 0
  288. TextButton4.ZIndex = 4
  289. TextButton4.Font = Enum.Font.SourceSans
  290. TextButton4.FontSize = Enum.FontSize.Size14
  291. TextButton4.Text = "<"
  292. TextButton4.TextColor = BrickColor.new("Institutional white")
  293. TextButton4.TextColor3 = Color3.new(1, 1, 1)
  294. TextButton4.TextScaled = true
  295. TextButton4.TextSize = 14
  296. TextButton4.TextStrokeTransparency = 0
  297. TextButton4.TextWrap = true
  298. TextButton4.TextWrapped = true
  299. ImageLabel5.Name = "backward_Roundify_12px"
  300. ImageLabel5.Parent = TextButton4
  301. ImageLabel5.Position = UDim2.new(0.5, 0, 0.5, 0)
  302. ImageLabel5.Size = UDim2.new(1, 0, 1, 0)
  303. ImageLabel5.Active = true
  304. ImageLabel5.AnchorPoint = Vector2.new(0.5, 0.5)
  305. ImageLabel5.BackgroundColor = BrickColor.new("Institutional white")
  306. ImageLabel5.BackgroundColor3 = Color3.new(1, 1, 1)
  307. ImageLabel5.BackgroundTransparency = 1
  308. ImageLabel5.Selectable = true
  309. ImageLabel5.ZIndex = 3
  310. ImageLabel5.Image = "rbxassetid://3570695787"
  311. ImageLabel5.ImageColor3 = Color3.new(0, 0, 0)
  312. ImageLabel5.ScaleType = Enum.ScaleType.Slice
  313. ImageLabel5.SliceCenter = Rect.new(100, 100, 100, 100)
  314. TextButton6.Name = "forward"
  315. TextButton6.Parent = Frame1
  316. TextButton6.Position = UDim2.new(0.917100787, 0, 0.941986382, 0)
  317. TextButton6.Size = UDim2.new(0.0819196776, 0, 0.0577489771, 0)
  318. TextButton6.BackgroundColor = BrickColor.new("Really black")
  319. TextButton6.BackgroundColor3 = Color3.new(0, 0, 0)
  320. TextButton6.BackgroundTransparency = 1
  321. TextButton6.BorderColor = BrickColor.new("Really black")
  322. TextButton6.BorderColor3 = Color3.new(0, 0, 0)
  323. TextButton6.BorderSizePixel = 0
  324. TextButton6.ZIndex = 4
  325. TextButton6.Font = Enum.Font.SourceSans
  326. TextButton6.FontSize = Enum.FontSize.Size14
  327. TextButton6.Text = ">"
  328. TextButton6.TextColor = BrickColor.new("Institutional white")
  329. TextButton6.TextColor3 = Color3.new(1, 1, 1)
  330. TextButton6.TextScaled = true
  331. TextButton6.TextSize = 14
  332. TextButton6.TextStrokeTransparency = 0
  333. TextButton6.TextWrap = true
  334. TextButton6.TextWrapped = true
  335. ImageLabel7.Name = "forward_Roundify_12px"
  336. ImageLabel7.Parent = TextButton6
  337. ImageLabel7.Position = UDim2.new(0.5, 0, 0.5, 0)
  338. ImageLabel7.Size = UDim2.new(1, 0, 1, 0)
  339. ImageLabel7.Active = true
  340. ImageLabel7.AnchorPoint = Vector2.new(0.5, 0.5)
  341. ImageLabel7.BackgroundColor = BrickColor.new("Institutional white")
  342. ImageLabel7.BackgroundColor3 = Color3.new(1, 1, 1)
  343. ImageLabel7.BackgroundTransparency = 1
  344. ImageLabel7.Selectable = true
  345. ImageLabel7.ZIndex = 3
  346. ImageLabel7.Image = "rbxassetid://3570695787"
  347. ImageLabel7.ImageColor3 = Color3.new(0, 0, 0)
  348. ImageLabel7.ScaleType = Enum.ScaleType.Slice
  349. ImageLabel7.SliceCenter = Rect.new(100, 100, 100, 100)
  350. TextLabel8.Name = "desc"
  351. TextLabel8.Parent = Frame1
  352. TextLabel8.Position = UDim2.new(0, 0, 6.07709936e-08, 0)
  353. TextLabel8.Size = UDim2.new(1, 0, 0.941986322, 0)
  354. TextLabel8.BackgroundColor = BrickColor.new("Black")
  355. TextLabel8.BackgroundColor3 = Color3.new(0.141176, 0.141176, 0.141176)
  356. TextLabel8.BorderSizePixel = 0
  357. TextLabel8.ZIndex = 3
  358. TextLabel8.Font = Enum.Font.SourceSans
  359. TextLabel8.FontSize = Enum.FontSize.Size24
  360. TextLabel8.Text = ""
  361. TextLabel8.TextColor = BrickColor.new("Institutional white")
  362. TextLabel8.TextColor3 = Color3.new(1, 1, 1)
  363. TextLabel8.TextSize = 20
  364. TextLabel8.TextStrokeTransparency = 0
  365. TextLabel8.TextWrap = true
  366. TextLabel8.TextWrapped = true
  367. ImageLabel9.Name = "Frame"
  368. ImageLabel9.Parent = Frame1
  369. ImageLabel9.Position = UDim2.new(0, 0, 0.898176789, 0)
  370. ImageLabel9.Size = UDim2.new(1, 0, 0.100000001, 0)
  371. ImageLabel9.BackgroundColor = BrickColor.new("Institutional white")
  372. ImageLabel9.BackgroundColor3 = Color3.new(1, 1, 1)
  373. ImageLabel9.BackgroundTransparency = 1
  374. ImageLabel9.ZIndex = 2
  375. ImageLabel9.Image = "rbxassetid://3570695787"
  376. ImageLabel9.ImageColor3 = Color3.new(0.141176, 0.141176, 0.141176)
  377. ImageLabel9.ScaleType = Enum.ScaleType.Slice
  378. ImageLabel9.SliceCenter = Rect.new(100, 100, 100, 100)
  379.    
  380. local System = {}
  381.  
  382. local currentpage,maxpage,equipped = 1,0,false
  383. local pagetxt,desctxt,forward,backward
  384.  
  385. for i,v in pairs(ScreenGui0:GetDescendants()) do
  386.     if v.Name == 'backward' then
  387.         backward = v
  388.     elseif v.Name == 'forward' then
  389.         forward = v
  390.     elseif v.Name == 'desc' then
  391.         desctxt = v
  392.     elseif v.Name == 'page' then
  393.         pagetxt = v
  394.     end
  395. end
  396.  
  397. for i,v in pairs(bookdata.pages) do
  398.     maxpage = maxpage+1
  399. end
  400.  
  401. warn("Total pages: " .. maxpage)
  402.  
  403. local flip = Instance.new("Sound",book)
  404. flip.SoundId = "rbxassetid://138723647"
  405. flip.Volume = 1
  406.  
  407. function System:ConvertNumeral(num)
  408.     local UseText = ""
  409.     local StoredScore = num
  410.     local Thousand = false
  411.     for i = 1,StoredScore / 1000 do
  412.         Thousand = true
  413.         StoredScore = StoredScore - 1000
  414.         UseText = UseText.." TH"
  415.     end
  416.     if Thousand then
  417.         UseText = UseText..[[
  418. ]]
  419.     end
  420.     local Hundred = false
  421.     for i = 1,StoredScore / 100 do
  422.         Hundred = true
  423.         StoredScore = StoredScore - 100
  424.         UseText = UseText.." H"
  425.     end
  426.     if Hundred then
  427.         UseText = UseText..[[
  428. ]]
  429.     end
  430.     local Ten = false
  431.     for i = 1,StoredScore / 10 do
  432.         Ten = true
  433.         StoredScore = StoredScore - 10
  434.         UseText = UseText.." T"
  435.     end
  436.     if Ten then
  437.         UseText = UseText..[[
  438. ]]
  439.     end
  440.     local Five = false
  441.     for i = 1,StoredScore / 5 do
  442.         Five = true
  443.         StoredScore = StoredScore - 5
  444.         UseText = UseText.." V"
  445.     end
  446.     if Five then
  447.         UseText = UseText..[[
  448. ]]
  449.     end
  450.     for i = 1,StoredScore do
  451.         StoredScore = StoredScore - 1
  452.         UseText = UseText.." I"
  453.     end
  454.     UseText = UseText.." "
  455.     return UseText
  456. end
  457.  
  458. function System:TurnPage(mode)
  459.     pcall(function()
  460.         if mode == 1 then
  461.             if maxpage > currentpage then currentpage = currentpage+1 else return end
  462.             flip:Play()
  463.         elseif mode == 2 then
  464.             if currentpage > 1 then currentpage = currentpage-1 else return end
  465.             flip:Play()
  466.         else return end
  467.     end)
  468. end
  469.  
  470. function System:LoadPage()
  471.     local page = bookdata.pages[tostring(currentpage)]
  472.     pagetxt.PlaceholderText = "Page: " .. System:ConvertNumeral(currentpage)
  473.     pagetxt.Text = "Page: " .. System:ConvertNumeral(currentpage)
  474.     desctxt.PlaceholderText = page['desc']
  475.     desctxt.Text = page['desc']
  476. end
  477.  
  478. for _,v in pairs(tool:GetChildren()) do
  479.     if v ~= book and v:IsA("BasePart") then
  480.         local weld = Instance.new("Weld")
  481.         weld.Part0 = book
  482.         weld.Part1 = v
  483.         weld.C0 = book.CFrame:Inverse()
  484.         weld.C1 = v.CFrame:Inverse()
  485.         v.Anchored = false
  486.         v.CanCollide = false
  487.         v.Massless = true
  488.         weld.Parent = v
  489.     end
  490. end
  491.  
  492. book.Anchored = false
  493. book.CanCollide = true
  494. book.Massless = true
  495. tool.Parent = plr['Backpack']
  496. tool.ToolTip = 'Makes you wiser than ever!'
  497.  
  498. System:LoadPage()
  499.  
  500. forward.MouseButton1Click:Connect(function()
  501.     pcall(function()
  502.     System:TurnPage(1)
  503.     System:LoadPage()
  504.     end)
  505. end)
  506.  
  507. backward.MouseButton1Click:Connect(function()
  508.     pcall(function()
  509.     System:TurnPage(2)
  510.     System:LoadPage()
  511.     end)
  512. end)
  513.  
  514. function CheckIfAlive()
  515.     return (((plr and plr.Parent and char and char.Parent and hum and hum.Parent and hum.Health > 0 and torso and torso.Parent) and true) or false)
  516. end
  517.  
  518. function Equipped()
  519.     char = tool.Parent
  520.     plr = game:GetService("Players"):GetPlayerFromCharacter(char)
  521.     hum = char:FindFirstChildOfClass("Humanoid")
  522.     torso = char:FindFirstChild("Torso") or char:FindFirstChild("HumanoidRootPart")
  523.     ScreenGui0.Parent = plr['PlayerGui']
  524.     System:LoadPage()
  525.     if not CheckIfAlive() then tool.Parent = nil return end
  526.     equipped = true
  527. end
  528.  
  529. function Unequipped()
  530.     ScreenGui0.Parent = nil
  531.     equipped = false
  532. end
  533.  
  534. tool.Equipped:Connect(Equipped)
  535. tool.Unequipped:Connect(Unequipped)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement