Advertisement
Reversal00

yes

Feb 24th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 44.25 KB | None | 0 0
  1. -- Synapse Decompiler
  2. -- Purchase Here: https://brack4712.xyz/synapse/purchase/
  3.  
  4. local rs = game:GetService("RunService")
  5. local ts = game:GetService("TweenService")
  6. local uis = game:GetService("UserInputService")
  7. local ms = game:GetService("MarketplaceService")
  8. game.Players.LocalPlayer:WaitForChild("PlayerGui"):SetTopbarTransparency(1)
  9. local player = game.Players.LocalPlayer
  10. local mouse = player:GetMouse()
  11. local camera = game.Workspace.CurrentCamera
  12. local onIOS = game:GetService("UserInputService").TouchEnabled
  13. local mouseDown = false
  14. local soundOn = true
  15. local coins, inventory, equipped, ownedItems, offer, rebirths, skins, skinEquipped = game.Workspace.RemoteFunction:InvokeServer("GetStats")
  16. local ownedPasses = game.Workspace.RemoteFunction:InvokeServer("GetPasses")
  17. local blockModule = require(game.Lighting.Assets.Modules.BlockModule)
  18. local backpackModule = require(game.Lighting.Assets.Modules.BackpackModule)
  19. local musicModule = require(script.ModuleResources.MusicModule)
  20. local soundModule = require(script.ModuleResources.SoundModule)
  21. local animationModule = require(script.ModuleResources.AnimationModule)
  22. local toolModule = require(game.Lighting.Assets.Modules.ToolModule)
  23. local shopModule = require(game.Lighting.Assets.Modules.ShopModule)
  24. local cratesModule = require(game.Lighting.Assets.Modules.CrateModule)
  25. local textureModule = require(game.Lighting.Assets.Modules.TextureModule)
  26. local currentFrame = ""
  27. local uiPositions = {}
  28. local openPositions = {
  29. BackpackFull = UDim2.new(0.5, 0, 0.5),
  30. Customize = UDim2.new(0.5, 0, 0.5),
  31. CollapsedCave = UDim2.new(0.5, 0, 0.5),
  32. OpenShop = UDim2.new(0.5, 0, 0.5, 0),
  33. PurchaseFrame = UDim2.new(0.5, 0, 0.5, 0),
  34. BetterTool = UDim2.new(0.5, 0, 0.5, 0),
  35. StarterPack = UDim2.new(0.5, 0, 0.5, 0),
  36. Twitter = UDim2.new(0.5, 0, 0.5, 0),
  37. Rebirth = UDim2.new(0.5, 0, 0.5, 0),
  38. Bugs = UDim2.new(0.5, 0, 0.5, 0),
  39. JoinGroup = UDim2.new(0.5, 0, 0.5, 0),
  40. MainButtons = UDim2.new(),
  41. StatsFrame = UDim2.new(),
  42. StatsFrame2 = UDim2.new(),
  43. CratesFrame = UDim2.new(0.5, 0, 0.5, 0),
  44. InventoryFrame = UDim2.new(0.5, 0, 0.5, 0)
  45. }
  46. local shopIndex
  47. local shopCategory = ""
  48. local maxRange = 20
  49. local currentSound, currentAnim
  50. local debThing = false
  51. local collapse = game.Workspace.Collapse
  52. local selectionBox = script.SelectionBox:Clone()
  53. selectionBox.Parent = nil
  54. mouse.TargetFilter = game.Workspace.MiningArea
  55. local onXbox = uis.GamepadEnabled
  56. local rarityColors = {
  57. Common = Color3.new(1, 1, 1),
  58. Unique = Color3.new(1, 0.6941176470588235, 0.48627450980392156),
  59. Rare = Color3.new(1, 0.34509803921568627, 0.34509803921568627),
  60. Epic = Color3.new(0.6588235294117647, 0.41568627450980394, 1)
  61. }
  62. function addCommas(num)
  63. local f, k = num, nil
  64. while true do
  65. f, k = string.gsub(f, "^(-?%d+)(%d%d%d)", "%1,%2")
  66. if k == 0 then
  67. break
  68. end
  69. end
  70. return f
  71. end
  72. function colorRarity(obj, rarity)
  73. if rarity == "Legendary" then
  74. do
  75. local num = 0
  76. spawn(function()
  77. while true do
  78. if not wait() or not obj.Parent then
  79. break
  80. end
  81. if num > 1 then
  82. num = 0
  83. end
  84. num = num + 0.01
  85. if obj:IsA("TextLabel") then
  86. obj.TextColor3 = Color3.fromHSV(num, 0.4, 1)
  87. elseif obj:IsA("Frame") then
  88. for a, b in pairs(obj:GetChildren()) do
  89. b.ImageColor3 = Color3.fromHSV(num, 0.4, 1)
  90. end
  91. end
  92. end
  93. end)
  94. end
  95. elseif obj:IsA("TextLabel") then
  96. obj.TextColor3 = rarityColors[rarity]
  97. elseif obj:IsA("Frame") then
  98. for a, b in pairs(obj:GetChildren()) do
  99. b.ImageColor3 = rarityColors[rarity]
  100. end
  101. end
  102. end
  103. function updateSelectable()
  104. local function recurse(parent, var)
  105. for a, b in pairs(parent:GetChildren()) do
  106. do
  107. local can = pcall(function()
  108. local thing = b.Selectable
  109. end)
  110. if can then
  111. if b:IsA("TextButton") or b:IsA("ImageButton") then
  112. b.Selectable = var
  113. else
  114. b.Selectable = false
  115. end
  116. recurse(b, var)
  117. end
  118. end
  119. end
  120. end
  121. for a, b in pairs(openPositions) do
  122. local var = false
  123. if a == currentFrame then
  124. var = true
  125. end
  126. recurse(script.Parent[a], var)
  127. end
  128. end
  129. function displayCurrent()
  130. for a, b in pairs(script.Parent:GetChildren()) do
  131. if b:IsA("Frame") or b:IsA("ImageLabel") then
  132. pcall(function()
  133. b:TweenPosition(uiPositions[b.Name], "Out", "Sine", 0.25, true)
  134. end)
  135. end
  136. end
  137. if uiPositions[currentFrame] then
  138. script.Parent[currentFrame]:TweenPosition(openPositions[currentFrame], "Out", "Sine", 0.25, true)
  139. end
  140. updateSelectable()
  141. end
  142. function changeText(obj, text)
  143. obj.Text = text
  144. if obj:FindFirstChild("Shadow") then
  145. obj.Shadow.Text = text
  146. end
  147. end
  148. function chatBubble(plr, msg, color)
  149. if not plr:FindFirstChild("Head") then
  150. return
  151. end
  152. if plr.Head:FindFirstChild("ChatBubble") then
  153. do
  154. local bubbleType = ""
  155. if string.len(msg) > 65 then
  156. msg = string.sub(msg, 1, 65) .. "..."
  157. end
  158. if string.len(msg) > 50 then
  159. bubbleType = "BigBubble"
  160. elseif string.len(msg) > 30 then
  161. bubbleType = "MediumBubble"
  162. else
  163. bubbleType = "SmallBubble"
  164. end
  165. local bubble = script.ChatBubbles[bubbleType]:Clone()
  166. pcall(function()
  167. bubble.Backing.Old.ImageColor3 = color
  168. bubble.Backing.Recent.ImageColor3 = color
  169. end)
  170. for a, b in pairs(plr.Head.ChatBubble:GetChildren()) do
  171. if b:IsA("Frame") then
  172. local bubbleNum = tonumber(string.sub(b.Name, 7))
  173. if bubbleNum < 3 then
  174. local trans = 0.2 * bubbleNum
  175. b.Position = b.Position - UDim2.new(0, 0, bubble.Size.Y.Scale, 0)
  176. b.Backing.Old.Visible = true
  177. b.Backing.Recent.Visible = false
  178. b.Name = "Bubble" .. bubbleNum + 1
  179. b.Backing.Old.ImageTransparency = trans
  180. b.Backing.Recent.ImageTransparency = trans
  181. if b.Backing:FindFirstChild("Emoji") then
  182. b.Backing.Emoji.ImageTransparency = trans
  183. else
  184. b.Backing.Chat.TextTransparency = trans
  185. end
  186. else
  187. b:Destroy()
  188. end
  189. end
  190. end
  191. bubble.Parent = plr.Head.ChatBubble
  192. bubble.Name = "Bubble1"
  193. if bubble.Backing:FindFirstChild("Emoji") then
  194. bubble.Backing.Emoji.Image = msg
  195. else
  196. bubble.Backing.Chat.Text = msg
  197. end
  198. spawn(function()
  199. wait(5)
  200. if bubble.Parent then
  201. for i = 1, 100 do
  202. pcall(function()
  203. bubble.Backing.Old.ImageTransparency = bubble.Backing.Old.ImageTransparency + 0.01
  204. bubble.Backing.Recent.ImageTransparency = bubble.Backing.Recent.ImageTransparency + 0.01
  205. if bubble.Backing:FindFirstChild("Emoji") then
  206. bubble.Backing.Emoji.ImageTransparency = bubble.Backing.Emoji.ImageTransparency + 0.01
  207. else
  208. bubble.Backing.Chat.TextTransparency = bubble.Backing.Chat.TextTransparency + 0.01
  209. end
  210. rs.Stepped:wait()
  211. end)
  212. end
  213. bubble:Destroy()
  214. end
  215. end)
  216. end
  217. end
  218. end
  219. function findFirstParent(obj, parent)
  220. local function find(current)
  221. if current.Parent == parent then
  222. return current
  223. elseif current.Parent == game then
  224. return nil
  225. else
  226. return find(current.Parent)
  227. end
  228. end
  229. return find(obj)
  230. end
  231. function updateSelection()
  232. local targ
  233. if onXbox == false then
  234. targ = mouse.Target
  235. else
  236. local ray = Ray.new(camera.CFrame.p, (mouse.Hit.p - camera.CFrame.p).unit * 1000)
  237. local hit, pos = game.Workspace:FindPartOnRayWithIgnoreList(ray, {
  238. game.Workspace.MiningArea
  239. })
  240. targ = hit
  241. end
  242. if not targ then
  243. selectionBox.Parent = nil
  244. script.Parent.MiningFrame.Visible = false
  245. script.Parent.XboxFrame.MiningFrame.Visible = false
  246. if currentSound then
  247. currentSound:Stop()
  248. end
  249. return
  250. end
  251. if player.Character:FindFirstChild("Pickaxe") then
  252. if targ:IsDescendantOf(game.Workspace.Blocks) then
  253. script.Parent.XboxFrame.MiningFrame.Visible = onXbox
  254. else
  255. script.Parent.XboxFrame.MiningFrame.Visible = false
  256. end
  257. end
  258. local isBlock = findFirstParent(targ, game.Workspace.Blocks)
  259. if isBlock and player.Character:FindFirstChild("Pickaxe") and isBlock.Name ~= "Rock Bottom" then
  260. local dis = (isBlock.PrimaryPart.Position - player.Character.HumanoidRootPart.Position).magnitude
  261. selectionBox.Parent = game.Workspace.MiningArea
  262. selectionBox.CFrame = isBlock.PrimaryPart.CFrame
  263. script.Parent.MiningFrame.Visible = true
  264. if dis <= maxRange then
  265. selectionBox.Color = Color3.new(0, 1, 0)
  266. script.Parent.MiningFrame.ItemName.TextColor3 = blockModule[isBlock.Name][4]
  267. script.Parent.MiningFrame.Amount.Visible = true
  268. script.Parent.MiningFrame.Logo.Visible = true
  269. local amount = blockModule[isBlock.Name][5] * (ownedPasses.VIP == true and 2 or 1) * (1 + rebirths)
  270. changeText(script.Parent.MiningFrame.ItemName, isBlock.Name .. " - " .. addCommas(isBlock.Stats.Health.Value))
  271. changeText(script.Parent.MiningFrame.Amount, "Value: " .. addCommas(amount))
  272. script.Parent.MiningFrame.Logo.Position = script.Parent.MiningFrame.Amount.Position + UDim2.new(0, script.Parent.MiningFrame.Amount.TextBounds.X / 2 + 5, 0, 0)
  273. for a, b in pairs(script.Parent.MiningFrame.Progress:GetChildren()) do
  274. b.ImageColor3 = blockModule[isBlock.Name][4]
  275. end
  276. else
  277. selectionBox.Color = Color3.new(1, 0, 0)
  278. script.Parent.MiningFrame.ItemName.TextColor3 = Color3.new(1, 0, 0)
  279. script.Parent.MiningFrame.Amount.Visible = false
  280. script.Parent.MiningFrame.Logo.Visible = false
  281. changeText(script.Parent.MiningFrame.ItemName, "Out of range")
  282. for a, b in pairs(script.Parent.MiningFrame.Progress:GetChildren()) do
  283. b.ImageColor3 = Color3.new(1, 0, 0)
  284. end
  285. end
  286. else
  287. script.Parent.MiningFrame.Visible = false
  288. selectionBox.Parent = nil
  289. end
  290. end
  291. function inventoryContents()
  292. local num = 0
  293. for i = 1, #inventory do
  294. num = num + inventory[i][2]
  295. end
  296. return num
  297. end
  298. function displayStats()
  299. ts:Create(script.Parent.StatsFrame.Coins.Value, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {Value = coins}):Play()
  300. local num = backpackModule[equipped[1]]
  301. if ownedPasses["Infinite Storage"] then
  302. num = "inf"
  303. else
  304. num = addCommas(num)
  305. end
  306. changeText(script.Parent.StatsFrame.Inventory.Amount, addCommas(inventoryContents()) .. " / " .. num)
  307. changeText(script.Parent.StatsFrame2.Inventory.Amount, addCommas(inventoryContents()) .. " / " .. num)
  308. spawn(function()
  309. wait(1)
  310. changeText(script.Parent.StatsFrame.Coins.Amount, addCommas(math.floor(coins)))
  311. changeText(script.Parent.StatsFrame2.Coins.Amount, addCommas(math.floor(coins)))
  312. end)
  313. end
  314. local mining = 0
  315. function mineBlock()
  316. local targ = mouse.Target
  317. if not targ or mining > 1 then
  318. return
  319. end
  320. local isBlock = findFirstParent(targ, game.Workspace.Blocks)
  321. local tool = player.Character:FindFirstChild("Pickaxe")
  322. if tool and tool:FindFirstChild("Explosive") then
  323. return
  324. end
  325. if isBlock then
  326. if isBlock.Name == "Rock Bottom" then
  327. return
  328. end
  329. if (isBlock.PrimaryPart.Position - player.Character.HumanoidRootPart.Position).magnitude <= maxRange then
  330. local broke = false
  331. mining = mining + 1
  332. if soundOn == true then
  333. if currentSound.SoundId ~= "rbxassetid://" .. soundModule[isBlock.Name][1] then
  334. currentSound.SoundId = "rbxassetid://" .. soundModule[isBlock.Name][1]
  335. currentSound.Looped = true
  336. currentSound:Play()
  337. end
  338. currentSound.Volume = soundModule[isBlock.Name][2]
  339. currentSound.Pitch = soundModule[isBlock.Name][3]
  340. end
  341. repeat
  342. wait()
  343. local start = tick()
  344. local mineTime = blockModule[isBlock.Name][3] / toolModule[player.Character.Pickaxe.Type.Value][1]
  345. local newTarg
  346. local del = 0.05
  347. local counter = 0
  348. if mineTime < 0.25 then
  349. mineTime = 0.25
  350. end
  351. mineTime = mineTime / (ownedPasses["2xDig"] and 2 or 1)
  352. if mineTime >= 20 then
  353. currentFrame = "BetterTool"
  354. displayCurrent()
  355. broke = true
  356. break
  357. end
  358. if not isBlock:FindFirstChild("Stats") then
  359. broke = true
  360. break
  361. end
  362. mineTime = mineTime * isBlock.Stats.Multiplier.Value
  363. script.Parent.MiningFrame.Progress:TweenSize(UDim2.new(1, -14, 1, -14), "Out", "Linear", mineTime, true)
  364. repeat
  365. wait(del)
  366. newTarg = mouse.Target
  367. newTarg = newTarg and findFirstParent(newTarg, game.Workspace.Blocks)
  368. counter = counter + del
  369. if counter > 1 then
  370. counter = 0
  371. end
  372. until mouseDown == false or mineTime <= tick() - start or newTarg ~= isBlock or not player.Character:FindFirstChild("Pickaxe")
  373. script.Parent.MiningFrame.Progress:TweenSize(UDim2.new(0, 14, 1, -14), "Out", "Sine", 0.01, true)
  374. if mouseDown == true and newTarg == isBlock and player.Character:FindFirstChild("Pickaxe") then
  375. local invNum = inventoryContents()
  376. if ownedPasses["Infinite Storage"] == true then
  377. invNum = 0
  378. end
  379. if mineTime <= tick() - start and invNum < backpackModule[equipped[1]] then
  380. game.Workspace.RemoteEvent:FireServer("MineBlock", isBlock)
  381. elseif inventoryContents() >= backpackModule[equipped[1]] then
  382. currentFrame = "BackpackFull"
  383. displayCurrent()
  384. end
  385. else
  386. broke = true
  387. end
  388. until broke == true or not isBlock.Parent
  389. mining = 0
  390. if mouseDown == true and player.Character:FindFirstChild("Pickaxe") then
  391. mineBlock()
  392. end
  393. end
  394. end
  395. end
  396. function coinAnimation(num)
  397. for i = 1, num do
  398. do
  399. local num = math.random(5, 8) / 100
  400. local rootPos = UDim2.new(0.5, 0, 0.7, 0)
  401. local money = script.UIResources.Money:Clone()
  402. money.Parent = script.Parent.SellFrame
  403. money.ImageTransparency = 1
  404. money.Size = UDim2.new(1, 0, num + 0.05, 0)
  405. money.Position = rootPos + UDim2.new(0, math.random(-50, 50), 0, math.random(-50, 50))
  406. spawn(function()
  407. ts:Create(money, TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {
  408. Size = UDim2.new(1, 0, num, 0),
  409. ImageTransparency = 0
  410. }):Play()
  411. wait(0.6)
  412. ts:Create(money, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {
  413. Size = UDim2.new(1, 0, 0, 0),
  414. ImageTransparency = 1,
  415. Position = UDim2.new(0, script.Parent.StatsFrame.Coins.Logo.AbsolutePosition.X, 0, script.Parent.StatsFrame.Coins.Logo.AbsolutePosition.Y)
  416. }):Play()
  417. wait(1)
  418. money:Destroy()
  419. end)
  420. wait(math.random(1, 4) / 100)
  421. end
  422. end
  423. end
  424. function transitionSong(id)
  425. spawn(function()
  426. if soundOn == true then
  427. ts:Create(script.Parent.Music, TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {Volume = 0}):Play()
  428. wait(0.5)
  429. ts:Create(script.Parent.Music, TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {Volume = 0.25}):Play()
  430. end
  431. script.Parent.Music.SoundId = "rbxassetid://" .. id
  432. script.Parent.Music:Play()
  433. end)
  434. end
  435. function updateCollapsed()
  436. if game.Workspace.Collapsed.Value == true then
  437. if collapse.Parent ~= game.Workspace then
  438. collapse.Parent = game.Workspace
  439. end
  440. elseif collapse.Parent then
  441. collapse.Parent = nil
  442. end
  443. end
  444. function stopAnim()
  445. for a, b in pairs(player.Character.Humanoid:GetPlayingAnimationTracks()) do
  446. local found = false
  447. for c, d in pairs(script.ModuleResources.AnimationModule:GetChildren()) do
  448. if b.Name == d.Name then
  449. found = true
  450. break
  451. end
  452. end
  453. if found == true then
  454. b:Stop()
  455. end
  456. end
  457. local tool = player.Character:FindFirstChild("Pickaxe")
  458. if tool and (tool:FindFirstChild("Particle") or tool:FindFirstChild("Sound")) then
  459. game.Workspace.RemoteEvent:FireServer("PlayToolEffects", false)
  460. end
  461. currentAnim = nil
  462. end
  463. function updateShop(type)
  464. game.Workspace.Shop.Items:ClearAllChildren()
  465. shopCategory = type
  466. currentFrame = ""
  467. displayCurrent()
  468. script.Parent.MainButtons.Visible = false
  469. script.Parent.StatsFrame.Visible = false
  470. script.Parent.StatsFrame2.Visible = true
  471. script.Parent.TopInfoFrame.Visible = false
  472. script.Parent.ShopFrame.Visible = true
  473. game:GetService("StarterGui"):SetCoreGuiEnabled("Backpack", false)
  474. for i = 1, #shopModule[type] do
  475. local asset = game.Lighting.Assets.Shop[shopModule[type][i][1]]:Clone()
  476. asset.Parent = game.Workspace.Shop.Items
  477. if type ~= "Backpack" then
  478. asset:SetPrimaryPartCFrame(CFrame.new(game.Workspace.Shop.ItemPositions["Item" .. i].Look.Position) + Vector3.new(0, 0, 0))
  479. else
  480. asset:SetPrimaryPartCFrame(CFrame.new(game.Workspace.Shop.ItemPositions["Item" .. i].Look.Position) * CFrame.Angles(0, math.rad(180), 0) + Vector3.new(0, -1, 0))
  481. asset.Decore.Count.SurfaceGui.Fill.Size = UDim2.new(0, 0, 0, 0)
  482. local num = backpackModule[asset.Name]
  483. if num > 696969 then
  484. num = "inf"
  485. else
  486. num = "0/" .. addCommas(num)
  487. end
  488. changeText(asset.Decore.Count.SurfaceGui.Amount, num)
  489. end
  490. local light = Instance.new("PointLight", asset.PrimaryPart)
  491. light.Range = 15
  492. light.Brightness = 0.5
  493. if type == "Tools" then
  494. if asset.Name == equipped[3] then
  495. shopIndex = i
  496. end
  497. elseif type == "Backpack" and asset.Name == equipped[1] then
  498. shopIndex = i
  499. end
  500. end
  501. camera.CameraType = "Scriptable"
  502. camera.CFrame = CFrame.new(game.Workspace.Shop.ItemPositions["Item" .. shopIndex].Root.Position, game.Workspace.Shop.ItemPositions["Item" .. shopIndex].Look.Position)
  503. updateShopInfo()
  504. end
  505. function updateShopInfo()
  506. if not shopIndex then
  507. return
  508. end
  509. local item = shopModule[shopCategory][shopIndex]
  510. changeText(script.Parent.ShopFrame.Info.Title, shopCategory)
  511. changeText(script.Parent.ShopFrame.Info.ItemName, item[1])
  512. changeText(script.Parent.ShopFrame.Buy.Amount, addCommas(item[2]))
  513. script.Parent.ShopFrame.Buy.Logo.Position = UDim2.new(0.5, script.Parent.ShopFrame.Buy.Amount.TextBounds.X / 2 + 5, 0.5, 0)
  514. if shopCategory == "Tools" then
  515. local stats = toolModule[item[1]]
  516. if stats then
  517. script.Parent.ShopFrame.Buy.Storage.Visible = false
  518. script.Parent.ShopFrame.Buy.Damage.Visible = true
  519. changeText(script.Parent.ShopFrame.Buy.Damage, addCommas(stats[2]))
  520. if stats[5] then
  521. script.Parent.ShopFrame.Buy.Speed.Visible = false
  522. script.Parent.ShopFrame.Buy.Boom.Visible = true
  523. changeText(script.Parent.ShopFrame.Buy.Boom, addCommas(stats[5]))
  524. else
  525. script.Parent.ShopFrame.Buy.Speed.Visible = true
  526. script.Parent.ShopFrame.Buy.Boom.Visible = false
  527. changeText(script.Parent.ShopFrame.Buy.Speed, "x" .. addCommas(stats[1]))
  528. end
  529. else
  530. script.Parent.ShopFrame.Buy.Storage.Visible = false
  531. script.Parent.ShopFrame.Buy.Damage.Visible = false
  532. script.Parent.ShopFrame.Buy.Speed.Visible = false
  533. script.Parent.ShopFrame.Buy.Boom.Visible = false
  534. end
  535. else
  536. for a, b in pairs(script.Parent.ShopFrame.Buy:GetChildren()) do
  537. if b:IsA("TextLabel") and b.Name ~= "Amount" then
  538. if b.Name ~= "Storage" then
  539. b.Visible = false
  540. else
  541. b.Visible = true
  542. end
  543. end
  544. end
  545. local num = backpackModule[item[1]]
  546. local theHammer = 696969
  547. if num > theHammer then
  548. num = "inf"
  549. else
  550. num = addCommas(num)
  551. end
  552. changeText(script.Parent.ShopFrame.Buy.Storage, num)
  553. script.Parent.ShopFrame.Buy.Storage.Logo.Position = UDim2.new(0.5, -(script.Parent.ShopFrame.Buy.Storage.TextBounds.X / 2) - 10, 0.5, 0)
  554. end
  555. local owned = false
  556. for i = 1, #ownedItems do
  557. if ownedItems[i] == item[1] then
  558. owned = true
  559. break
  560. end
  561. end
  562. if item[3] then
  563. owned = ownedPasses[item[3][2]]
  564. end
  565. if owned == true then
  566. for a, b in pairs(script.Parent.ShopFrame.Buy.Decore.Inner:GetChildren()) do
  567. b.ImageColor3 = Color3.new(0.15294117647058825, 0.7058823529411765, 1)
  568. end
  569. for a, b in pairs(script.Parent.ShopFrame.Buy.Shadow:GetChildren()) do
  570. b.ImageColor3 = Color3.new(0.17647058823529413, 0.3686274509803922, 0.6)
  571. end
  572. local isEquipped = false
  573. if shopCategory == "Tools" then
  574. if equipped[3] == item[1] then
  575. isEquipped = true
  576. end
  577. elseif shopCategory == "Backpack" and equipped[1] == item[1] then
  578. isEquipped = true
  579. end
  580. changeText(script.Parent.ShopFrame.Buy.Amount, isEquipped == true and "Equipped" or "Equip")
  581. script.Parent.ShopFrame.Buy.Logo.Visible = false
  582. script.Parent.ShopFrame.Buy.Amount.TextColor3 = Color3.new(1, 1, 1)
  583. script.Parent.ShopFrame.Buy.Amount.AnchorPoint = Vector2.new(0.5, 0.5)
  584. else
  585. for a, b in pairs(script.Parent.ShopFrame.Buy.Decore.Inner:GetChildren()) do
  586. b.ImageColor3 = Color3.new(0.25882352941176473, 1, 0.12941176470588237)
  587. end
  588. for a, b in pairs(script.Parent.ShopFrame.Buy.Shadow:GetChildren()) do
  589. b.ImageColor3 = Color3.new(0, 0.5137254901960784, 0)
  590. end
  591. script.Parent.ShopFrame.Buy.Logo.Visible = true
  592. script.Parent.ShopFrame.Buy.Amount.TextColor3 = Color3.new(1, 0.7725490196078432, 0.24313725490196078)
  593. script.Parent.ShopFrame.Buy.Amount.AnchorPoint = Vector2.new(0.55, 0.5)
  594. end
  595. if item[3] and owned == false then
  596. script.Parent.ShopFrame.Buy.Logo.Visible = false
  597. script.Parent.ShopFrame.Buy.Amount.AnchorPoint = Vector2.new(0.5, 0.5)
  598. changeText(script.Parent.ShopFrame.Buy.Amount, addCommas(ms:GetProductInfo(item[3][1]).PriceInRobux) .. " R$")
  599. elseif owned == false then
  600. script.Parent.ShopFrame.Buy.Amount.AnchorPoint = Vector2.new(0.55, 0.5)
  601. script.Parent.ShopFrame.Buy.Logo.Visible = true
  602. end
  603. if item[3] and owned == true then
  604. changeText(script.Parent.ShopFrame.Buy.Amount, "Equipped")
  605. end
  606. if item[2] == "Group" then
  607. script.Parent.ShopFrame.Buy.Logo.Visible = false
  608. script.Parent.ShopFrame.Buy.Amount.AnchorPoint = Vector2.new(0.5, 0.5)
  609. changeText(script.Parent.ShopFrame.Buy.Amount, "Group Only")
  610. for a, b in pairs(script.Parent.ShopFrame.Buy.Decore.Inner:GetChildren()) do
  611. b.ImageColor3 = Color3.new(0.15294117647058825, 0.7058823529411765, 1)
  612. end
  613. for a, b in pairs(script.Parent.ShopFrame.Buy.Shadow:GetChildren()) do
  614. b.ImageColor3 = Color3.new(0.17647058823529413, 0.3686274509803922, 0.6)
  615. end
  616. if player:IsInGroup(3333298) then
  617. local isEquipped = false
  618. if shopCategory == "Tools" then
  619. if equipped[3] == item[1] then
  620. isEquipped = true
  621. end
  622. elseif shopCategory == "Backpack" and equipped[1] == item[1] then
  623. isEquipped = true
  624. end
  625. changeText(script.Parent.ShopFrame.Buy.Amount, isEquipped == true and "Equipped" or "Equip")
  626. end
  627. else
  628. script.Parent.ShopFrame.Buy.Amount.AnchorPoint = Vector2.new(0.55, 0.5)
  629. end
  630. end
  631. local shopDebounce = 0
  632. function closeShop()
  633. script.Parent.MainButtons.Visible = true
  634. script.Parent.StatsFrame.Visible = true
  635. script.Parent.StatsFrame2.Visible = false
  636. script.Parent.TopInfoFrame.Visible = true
  637. script.Parent.ShopFrame.Visible = false
  638. game:GetService("StarterGui"):SetCoreGuiEnabled("Backpack", true)
  639. game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
  640. game.Workspace.CurrentCamera.CameraType = "Custom"
  641. shopDebounce = tick()
  642. end
  643. function secToTime(time)
  644. local hours = math.floor(time / 3600)
  645. time = time - hours * 60 * 60
  646. local mins = math.floor(time / 60)
  647. time = time - mins * 60
  648. return hours .. ":" .. mins .. ":" .. time
  649. end
  650. function buyShopItem()
  651. if debThing == true then
  652. return
  653. end
  654. debThing = true
  655. local item = shopModule[shopCategory][shopIndex]
  656. local owned = false
  657. for i = 1, #ownedItems do
  658. if ownedItems[i] == item[1] then
  659. owned = true
  660. break
  661. end
  662. end
  663. if item[3] then
  664. owned = ownedPasses[item[3][2]]
  665. end
  666. if owned == true then
  667. local isEquipped = false
  668. if shopCategory == "Tools" then
  669. if equipped[3] == item[1] then
  670. isEquipped = true
  671. end
  672. elseif shopCategory == "Backpacks" and isEquipped[1] == item[1] then
  673. isEquipped = true
  674. end
  675. if isEquipped == false then
  676. game.Workspace.RemoteEvent:FireServer("EquipItem", shopCategory, item[1])
  677. end
  678. elseif not item[3] then
  679. local sendRequest = false
  680. if item[2] ~= "Group" then
  681. if coins - item[2] >= 0 then
  682. sendRequest = true
  683. else
  684. ms:PromptProductPurchase(player, 151466115)
  685. currentFrame = "PurchaseFrame"
  686. changeText(script.Parent.PurchaseFrame.Title, "Coins")
  687. script.Parent.PurchaseFrame.Coins.Visible = true
  688. script.Parent.PurchaseFrame.Passes.Visible = false
  689. displayCurrent()
  690. end
  691. else
  692. sendRequest = true
  693. end
  694. if sendRequest == true then
  695. game.Workspace.RemoteEvent:FireServer("BuyItem", shopCategory, shopIndex)
  696. end
  697. else
  698. ms:PromptPurchase(player, item[3][1])
  699. end
  700. wait(0.25)
  701. debThing = false
  702. end
  703. function getSkin(crate)
  704. local possible = {}
  705. local chosen = ""
  706. local rarities = {}
  707. local textureItems = {}
  708. for a, b in pairs(textureModule) do
  709. table.insert(textureItems, a)
  710. end
  711. for a, b in pairs(cratesModule[crate][3]) do
  712. table.insert(rarities, {
  713. a,
  714. cratesModule[crate][3][a]
  715. })
  716. end
  717. for i = 1, #rarities do
  718. for j = 1, math.floor(rarities[i][2] * 10) do
  719. table.insert(possible, rarities[i][1])
  720. end
  721. end
  722. chosen = possible[math.random(1, #possible)]
  723. local knife
  724. repeat
  725. local possibility = textureItems[math.random(1, #textureItems)]
  726. if textureModule[possibility] == chosen then
  727. knife = possibility
  728. end
  729. until knife ~= nil
  730. return knife
  731. end
  732. function spinCrate(winner, crate)
  733. local crateFrame = script.UIResources.CrateSystem:Clone()
  734. crateFrame.Parent = script.Parent
  735. local frame = crateFrame.Items.Items.Items
  736. spawn(function()
  737. wait(20)
  738. if frame.Parent then
  739. frame:Destroy()
  740. currentFrame = "InventoryFrame"
  741. displayCurrent()
  742. end
  743. end)
  744. for a, b in pairs(frame:GetChildren()) do
  745. if b:IsA("Frame") then
  746. b:Destroy()
  747. end
  748. end
  749. frame:TweenPosition(UDim2.new(), "Out", "Linear", 0.01)
  750. wait(0.05)
  751. for i = 1, 33 do
  752. local knife
  753. local item = script.UIResources.CrateItem:Clone()
  754. item.Parent = frame
  755. if i == 30 then
  756. knife = winner
  757. else
  758. knife = getSkin(crate)
  759. end
  760. item.Decore.Primary.Image = game.Lighting.Assets.Textures[knife].PrimaryTexture.Texture
  761. item.Decore.Primary.ImageColor3 = game.Lighting.Assets.Textures[knife].PrimaryTexture.Color3
  762. item.Decore.Primary.BackgroundColor3 = game.Lighting.Assets.Textures[knife].Primary.Color
  763. changeText(item.Decore.ItemName, knife)
  764. colorRarity(item.Decore.ItemName, textureModule[knife])
  765. changeText(item.Decore.ItemName, knife)
  766. end
  767. currentFrame = ""
  768. displayCurrent()
  769. crateFrame:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), "Out", "Sine", 0.5, true)
  770. wait(1)
  771. local speed = math.random(9, 12)
  772. frame:TweenPosition(UDim2.new(-4.8, 0, 0, 0), "Out", "Quint", speed / 2, true)
  773. wait(speed / 10)
  774. frame:TweenPosition(UDim2.new(-4.8, 0, 0, 0), "Out", "Quint", speed / 1, true)
  775. spawn(function()
  776. wait(speed / 2 + 2)
  777. crateFrame:Destroy()
  778. currentFrame = "InventoryFrame"
  779. displayCurrent()
  780. end)
  781. end
  782. function updateInventory()
  783. for a, b in pairs(script.Parent.InventoryFrame.Items.Items:GetChildren()) do
  784. if b:IsA("TextButton") or b:IsA("Frame") then
  785. b:Destroy()
  786. end
  787. end
  788. for i = 1, #skins do
  789. do
  790. local item = script.UIResources.InventoryItem:Clone()
  791. item.Parent = script.Parent.InventoryFrame.Items.Items
  792. if skins[i][1] ~= "Default" then
  793. item.Decore.Primary.Image = game.Lighting.Assets.Textures[skins[i][1]].PrimaryTexture.Texture
  794. item.Decore.Primary.ImageColor3 = game.Lighting.Assets.Textures[skins[i][1]].PrimaryTexture.Color3
  795. item.Decore.Primary.BackgroundColor3 = game.Lighting.Assets.Textures[skins[i][1]].Primary.Color
  796. changeText(item.Decore.ItemName, skins[i][1])
  797. colorRarity(item.Decore.ItemName, textureModule[skins[i][1]])
  798. else
  799. item.Decore.Primary.Visible = false
  800. end
  801. changeText(item.Decore.Amount, 1 < skins[i][2] and "x" .. skins[i][2] or "")
  802. changeText(item.Decore.ItemName, skins[i][1])
  803. if skins[i][1] == skinEquipped then
  804. for a, b in pairs(item.Decore.Decore.Border:GetChildren()) do
  805. b.ImageColor3 = Color3.new(0, 1, 0)
  806. end
  807. end
  808. item.MouseButton1Down:connect(function()
  809. game.Workspace.RemoteEvent:FireServer("EquipTexture", skins[i][1])
  810. end)
  811. end
  812. end
  813. spawn(function()
  814. wait(0.5)
  815. script.Parent.InventoryFrame.Items.Items.CanvasSize = UDim2.new(0, 0, 0, script.Parent.InventoryFrame.Items.Items.UIGridLayout.AbsoluteContentSize.Y)
  816. end)
  817. end
  818. script.Event.Event:connect(function(type, ...)
  819. if type == "StopAnim" then
  820. stopAnim()
  821. end
  822. end)
  823. game.Workspace.RemoteEvent.OnClientEvent:connect(function(type, ...)
  824. if type == "PassesChanged" then
  825. ownedPasses = (...)
  826. updateShopInfo()
  827. if ownedPasses["Infinite Storage"] == true then
  828. script.Parent.BackpackFull.Infinite.Visible = false
  829. end
  830. if ownedPasses.Nuke == true then
  831. script.Parent.BetterTool.Nuke.Visible = false
  832. end
  833. if ownedPasses.VIP == true and game.Workspace:FindFirstChild("VIPWall") then
  834. game.Workspace.VIPWall:Destroy()
  835. end
  836. if ownedPasses["2xDig"] == true then
  837. script.Parent.CollapsedCave.FastDig.Visible = false
  838. script.Parent.Customize.Dig.Visible = false
  839. end
  840. elseif type == "StatsChanged" then
  841. coins, inventory, equipped, ownedItems, offer, rebirths, skins, skinEquipped = ...
  842. displayStats()
  843. updateShopInfo()
  844. if offer[2] == true or onXbox == true then
  845. currentFrame = ""
  846. displayCurrent()
  847. script.Parent.StatsFrame.StarterPackButton.Visible = false
  848. end
  849. elseif type == "PlayerChatted" then
  850. local plr, msg, col = ...
  851. chatBubble(plr.Character, msg, col)
  852. elseif type == "SellingAnimation" then
  853. do
  854. local num = (...)
  855. local originalNum = num
  856. if num > 15 then
  857. num = 15
  858. end
  859. script.Parent.SellFrame.Amount.Amount.Text = "+" .. addCommas(originalNum)
  860. ts:Create(script.Parent.SellFrame.Amount.Amount, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {TextTransparency = 0, TextStrokeTransparency = 0.5}):Play()
  861. ts:Create(script.Parent.SellFrame.Amount.Logo, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0}):Play()
  862. spawn(function()
  863. coinAnimation(num)
  864. end)
  865. wait(2)
  866. ts:Create(script.Parent.SellFrame.Amount.Amount, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {TextTransparency = 1, TextStrokeTransparency = 1}):Play()
  867. ts:Create(script.Parent.SellFrame.Amount.Logo, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 1}):Play()
  868. end
  869. elseif type == "StopAnim" then
  870. stopAnim()
  871. elseif type == "InventoryFull" then
  872. currentFrame = "BackpackFull"
  873. displayCurrent()
  874. elseif type == "SpecialOffer" then
  875. wait(1)
  876. currentFrame = "StarterPack"
  877. displayCurrent()
  878. elseif type == "JoinGroup" then
  879. currentFrame = "JoinGroup"
  880. displayCurrent()
  881. elseif type == "UpdateInventory" then
  882. skinEquipped, skins = ...
  883. updateInventory()
  884. elseif type == "OpenCrate" then
  885. spinCrate(...)
  886. end
  887. end)
  888. for a, b in pairs(script.Parent:GetChildren()) do
  889. if b:IsA("Frame") or b:IsA("ImageLabel") then
  890. uiPositions[b.Name] = b.Position
  891. end
  892. end
  893. for a, b in pairs(game.Workspace.NPCs:GetChildren()) do
  894. spawn(function()
  895. local anim = b.Humanoid:LoadAnimation(script.Animations.WaveAnim)
  896. wait(math.random(0, 20 * a) / 10)
  897. anim:Play()
  898. end)
  899. end
  900. do
  901. local lastVal = coins
  902. local last = tick()
  903. script.Parent.StatsFrame.Coins.Value.Changed:connect(function()
  904. if lastVal ~= coins and tick() - last > 0.1 then
  905. last = tick()
  906. lastVal = math.ceil(script.Parent.StatsFrame.Coins.Value.Value)
  907. changeText(script.Parent.StatsFrame.Coins.Amount, addCommas(math.ceil(script.Parent.StatsFrame.Coins.Value.Value)))
  908. changeText(script.Parent.StatsFrame2.Coins.Amount, script.Parent.StatsFrame.Coins.Amount.Text)
  909. local sound = game.Lighting.Assets.Sounds.Coins:Clone()
  910. sound.Parent = script.Parent.StatsFrame.Coins
  911. sound:Play()
  912. wait(sound.TimeLength)
  913. sound:Destroy()
  914. end
  915. end)
  916. end
  917. script.Parent.BackpackFull.Sell.MouseButton1Down:connect(function()
  918. currentFrame = ""
  919. displayCurrent()
  920. player.Character:SetPrimaryPartCFrame(CFrame.new(game.Workspace.TeleportPoints.SellSpawn.Position) + Vector3.new(0, 3, 0))
  921. end)
  922. script.Parent.BackpackFull.Upgrade.MouseButton1Down:connect(function()
  923. currentFrame = ""
  924. displayCurrent()
  925. player.Character:SetPrimaryPartCFrame(CFrame.new(game.Workspace.TeleportPoints.UpgradeSpawn.Position) + Vector3.new(0, 3, 0))
  926. end)
  927. script.Parent.BackpackFull.Upgrade.MouseButton1Down:connect(function()
  928. currentFrame = ""
  929. displayCurrent()
  930. player.Character:SetPrimaryPartCFrame(CFrame.new(game.Workspace.TeleportPoints.UpgradeSpawn.Position) + Vector3.new(0, 3, 0))
  931. end)
  932. script.Parent.MainButtons.Surface.MouseButton1Down:connect(function()
  933. currentFrame = ""
  934. displayCurrent()
  935. player.Character:SetPrimaryPartCFrame(CFrame.new(game.Workspace.TeleportPoints.SurfaceSpawn.Position) + Vector3.new(0, 3, 0))
  936. end)
  937. script.Parent.BackpackFull.Close.MouseButton1Down:connect(function()
  938. currentFrame = ""
  939. displayCurrent()
  940. end)
  941. script.Parent.MainButtons.Sound.MouseButton1Down:connect(function()
  942. soundOn = not soundOn
  943. if soundOn == true then
  944. script.Parent.MainButtons.Sound.Decore.ItemImage.Image = "rbxassetid://1417525348"
  945. script.Parent.Music.Volume = 0.25
  946. else
  947. script.Parent.MainButtons.Sound.Decore.ItemImage.Image = "rbxassetid://1420443979"
  948. script.Parent.Music.Volume = 0
  949. end
  950. end)
  951. script.Parent.MainButtons.Customize.MouseButton1Down:connect(function()
  952. currentFrame = "Customize"
  953. displayCurrent()
  954. end)
  955. script.Parent.Customize.Close.MouseButton1Down:connect(function()
  956. currentFrame = ""
  957. displayCurrent()
  958. end)
  959. for a, b in pairs(script.Parent.Customize.Colors:GetChildren()) do
  960. if b:IsA("TextButton") then
  961. b.MouseButton1Down:connect(function()
  962. game.Workspace.RemoteEvent:FireServer("ChangeColor", b.Name)
  963. currentFrame = ""
  964. displayCurrent()
  965. end)
  966. end
  967. end
  968. do
  969. local anim = game.Workspace.Collapse.Miner.Humanoid:LoadAnimation(script.Animations.MinerIdle)
  970. anim:Play()
  971. end
  972. game.Workspace.Collapsed.Changed:connect(function()
  973. updateCollapsed()
  974. if game.Workspace.Collapsed.Value == true then
  975. currentFrame = "CollapsedCave"
  976. displayCurrent()
  977. end
  978. end)
  979. script.Parent.CollapsedCave.Okay.MouseButton1Down:connect(function()
  980. currentFrame = ""
  981. displayCurrent()
  982. end)
  983. script.Parent.CollapsedCave.Close.MouseButton1Down:connect(function()
  984. currentFrame = ""
  985. displayCurrent()
  986. end)
  987. script.Parent.ShopFrame.Right.MouseButton1Down:connect(function()
  988. shopIndex = shopIndex + 1
  989. local speed = 0.01
  990. if shopIndex > #shopModule[shopCategory] then
  991. shopIndex = 1
  992. else
  993. speed = 1.5
  994. end
  995. ts:Create(camera, TweenInfo.new(speed, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {
  996. CFrame = CFrame.new(game.Workspace.Shop.ItemPositions["Item" .. shopIndex].Root.Position, game.Workspace.Shop.ItemPositions["Item" .. shopIndex].Look.Position)
  997. }):Play()
  998. updateShopInfo()
  999. end)
  1000. script.Parent.ShopFrame.Left.MouseButton1Down:connect(function()
  1001. shopIndex = shopIndex - 1
  1002. local speed = 0.01
  1003. if shopIndex < 1 then
  1004. shopIndex = #shopModule[shopCategory]
  1005. else
  1006. speed = 1.5
  1007. end
  1008. ts:Create(camera, TweenInfo.new(speed, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {
  1009. CFrame = CFrame.new(game.Workspace.Shop.ItemPositions["Item" .. shopIndex].Root.Position, game.Workspace.Shop.ItemPositions["Item" .. shopIndex].Look.Position)
  1010. }):Play()
  1011. updateShopInfo()
  1012. end)
  1013. script.Parent.ShopFrame.Buy.MouseButton1Down:connect(function()
  1014. buyShopItem()
  1015. end)
  1016. script.Parent.ShopFrame.Exit.MouseButton1Down:connect(function()
  1017. closeShop()
  1018. end)
  1019. script.Parent.ShopFrame.Close.MouseButton1Down:connect(function()
  1020. closeShop()
  1021. end)
  1022. script.Parent.OpenShop.Close.MouseButton1Down:connect(function()
  1023. shopDebounce = tick()
  1024. currentFrame = ""
  1025. displayCurrent()
  1026. end)
  1027. script.Parent.OpenShop.Tools.MouseButton1Down:connect(function()
  1028. updateShop("Tools")
  1029. end)
  1030. script.Parent.OpenShop.Backpacks.MouseButton1Down:connect(function()
  1031. updateShop("Backpack")
  1032. end)
  1033. script.Parent.TeleporterFrame.Teleport.MouseButton1Down:connect(function()
  1034. game.Workspace.RemoteEvent:FireServer("TeleportToPad")
  1035. end)
  1036. script.Parent.TeleporterFrame.Move.MouseButton1Down:connect(function()
  1037. game.Workspace.RemoteEvent:FireServer("RemovePad")
  1038. for a, b in pairs(script.Parent.TeleporterFrame:GetChildren()) do
  1039. if b:IsA("TextButton") then
  1040. b.Visible = false
  1041. end
  1042. end
  1043. script.Parent.TeleporterFrame.Info.Visible = true
  1044. end)
  1045. for a, b in pairs(script.Parent.PurchaseFrame.Coins:GetChildren()) do
  1046. if b:IsA("TextButton") then
  1047. b.MouseButton1Down:connect(function()
  1048. ms:PromptProductPurchase(player, b.DevProduct.Value)
  1049. end)
  1050. end
  1051. end
  1052. script.Parent.PurchaseFrame.Close.MouseButton1Down:connect(function()
  1053. currentFrame = ""
  1054. displayCurrent()
  1055. end)
  1056. script.Parent.StatsFrame.Coins.More.MouseButton1Down:connect(function()
  1057. currentFrame = "PurchaseFrame"
  1058. displayCurrent()
  1059. changeText(script.Parent.PurchaseFrame.Title, "Coins")
  1060. script.Parent.PurchaseFrame.Coins.Visible = true
  1061. script.Parent.PurchaseFrame.Passes.Visible = false
  1062. end)
  1063. script.Parent.StatsFrame2.Coins.More.MouseButton1Down:connect(function()
  1064. currentFrame = "PurchaseFrame"
  1065. displayCurrent()
  1066. changeText(script.Parent.PurchaseFrame.Title, "Coins")
  1067. script.Parent.PurchaseFrame.Coins.Visible = true
  1068. script.Parent.PurchaseFrame.Passes.Visible = false
  1069. end)
  1070. script.Parent.MainButtons.Shop.MouseButton1Down:connect(function()
  1071. currentFrame = "PurchaseFrame"
  1072. displayCurrent()
  1073. end)
  1074. script.Parent.PurchaseFrame.CoinsButton.MouseButton1Down:connect(function()
  1075. changeText(script.Parent.PurchaseFrame.Title, "Coins")
  1076. script.Parent.PurchaseFrame.Coins.Visible = true
  1077. script.Parent.PurchaseFrame.Passes.Visible = false
  1078. end)
  1079. script.Parent.PurchaseFrame.Gamepasses.MouseButton1Down:connect(function()
  1080. changeText(script.Parent.PurchaseFrame.Title, "Gamepasses")
  1081. script.Parent.PurchaseFrame.Coins.Visible = false
  1082. script.Parent.PurchaseFrame.Passes.Visible = true
  1083. end)
  1084. for a, b in pairs(script.Parent.PurchaseFrame.Passes:GetChildren()) do
  1085. if b:IsA("TextButton") then
  1086. local info = ms:GetProductInfo(b.DevProduct.Value)
  1087. changeText(b.Cost, addCommas(info.PriceInRobux) .. " R$")
  1088. b.MouseButton1Down:connect(function()
  1089. ms:PromptPurchase(player, b.DevProduct.Value)
  1090. end)
  1091. end
  1092. end
  1093. script.Parent.BetterTool.Upgrade.MouseButton1Down:connect(function()
  1094. currentFrame = ""
  1095. displayCurrent()
  1096. player.Character:SetPrimaryPartCFrame(CFrame.new(game.Workspace.TeleportPoints.UpgradeSpawn.Position) + Vector3.new(0, 3, 0))
  1097. end)
  1098. script.Parent.BetterTool.Close.MouseButton1Down:connect(function()
  1099. currentFrame = ""
  1100. displayCurrent()
  1101. end)
  1102. script.Parent.BetterTool.Cancel.MouseButton1Down:connect(function()
  1103. currentFrame = ""
  1104. displayCurrent()
  1105. end)
  1106. script.Parent.BackpackFull.Infinite.Buy.MouseButton1Down:connect(function()
  1107. ms:PromptPurchase(player, 1435271062)
  1108. end)
  1109. script.Parent.BetterTool.Nuke.Buy.MouseButton1Down:connect(function()
  1110. ms:PromptPurchase(player, 1435274498)
  1111. end)
  1112. if game.Workspace:FindFirstChild("VIPWall") then
  1113. game.Workspace.VIPWall.Touched:connect(function(t)
  1114. local plr = game.Players:FindFirstChild(t.Parent.Name)
  1115. if plr and plr == player then
  1116. ms:PromptPurchase(player, 1435282640)
  1117. end
  1118. end)
  1119. end
  1120. game.Workspace.VIPSign.Part.SurfaceGui.Buy.MouseButton1Down:connect(function()
  1121. ms:PromptPurchase(player, 1435282640)
  1122. end)
  1123. script.Parent.CollapsedCave.FastDig.Buy.MouseButton1Down:connect(function()
  1124. ms:PromptPurchase(player, 1435267597)
  1125. end)
  1126. script.Parent.Customize.Dig.Buy.MouseButton1Down:connect(function()
  1127. ms:PromptPurchase(player, 1435267597)
  1128. end)
  1129. script.Parent.StatsFrame.StarterPackButton.MouseButton1Down:connect(function()
  1130. currentFrame = "StarterPack"
  1131. displayCurrent()
  1132. end)
  1133. script.Parent.StarterPack.Close.MouseButton1Down:connect(function()
  1134. currentFrame = ""
  1135. displayCurrent()
  1136. end)
  1137. script.Parent.StarterPack.Buy.MouseButton1Down:connect(function()
  1138. ms:PromptProductPurchase(player, 152576666)
  1139. end)
  1140. script.Parent.Customize.Dig.Buy.MouseButton1Down:connect(function()
  1141. ms:PromptPurchase(player, 1435267597)
  1142. end)
  1143. do
  1144. local lastText = script.Parent.Twitter.Code.Text
  1145. script.Parent.Twitter.Code.Changed:connect(function()
  1146. if lastText ~= script.Parent.Twitter.Code.Text then
  1147. changeText(script.Parent.Twitter.Code.ItemName, script.Parent.Twitter.Code.Text)
  1148. lastText = script.Parent.Twitter.Code.Text
  1149. end
  1150. end)
  1151. end
  1152. script.Parent.Twitter.Code.Focused:connect(function()
  1153. changeText(script.Parent.Twitter.Code.ItemName, "")
  1154. end)
  1155. script.Parent.Twitter.Send.MouseButton1Down:connect(function()
  1156. local response = game.Workspace.RemoteFunction:InvokeServer("RedeemCode", script.Parent.Twitter.Code.Text)
  1157. script.Parent.Twitter.Code.Text = response
  1158. end)
  1159. script.Parent.Twitter.Close.MouseButton1Down:connect(function()
  1160. currentFrame = ""
  1161. displayCurrent()
  1162. end)
  1163. do
  1164. local lastText = script.Parent.Bugs.Code.Text
  1165. script.Parent.Bugs.Code.Changed:connect(function()
  1166. if lastText ~= script.Parent.Bugs.Code.Text then
  1167. changeText(script.Parent.Bugs.Code.ItemName, script.Parent.Bugs.Code.Text)
  1168. lastText = script.Parent.Bugs.Code.Text
  1169. end
  1170. end)
  1171. end
  1172. script.Parent.Bugs.Code.Focused:connect(function()
  1173. changeText(script.Parent.Bugs.Code.ItemName, "")
  1174. end)
  1175. local lastSend = 0
  1176. script.Parent.Bugs.Send.MouseButton1Down:connect(function()
  1177. if tick() - lastSend <= 60 then
  1178. script.Parent.Bugs.Code.Text = "Please wait " .. 60 - math.floor(tick() - lastSend) .. " second" .. (60 - math.floor(tick() - lastSend) > 1 and "s" or "") .. " before submitting another bug"
  1179. return
  1180. end
  1181. lastSend = tick()
  1182. game.Workspace.RemoteEvent:FireServer("BugReport", script.Parent.Bugs.Code.Text)
  1183. script.Parent.Bugs.Code.Text = "Thanks for your input!"
  1184. end)
  1185. script.Parent.Bugs.Close.MouseButton1Down:connect(function()
  1186. currentFrame = ""
  1187. displayCurrent()
  1188. end)
  1189. for a, b in pairs(script.Parent.StatsFrame.SubButtons:GetChildren()) do
  1190. if b:IsA("TextButton") then
  1191. b.MouseButton1Down:connect(function()
  1192. currentFrame = b.Name
  1193. displayCurrent()
  1194. if b.Name == "Rebirth" then
  1195. changeText(script.Parent.Rebirth.Multiplier, "Your ore value will be " .. 2 + rebirths .. "x after rebirthing")
  1196. changeText(script.Parent.Rebirth.CoinsNeeded, "You need " .. addCommas(10000000 * (rebirths + 1)) .. " coins to rebirth")
  1197. end
  1198. end)
  1199. end
  1200. end
  1201. local redeb = false
  1202. script.Parent.Rebirth.Send.MouseButton1Down:connect(function()
  1203. if redeb == true then
  1204. return
  1205. end
  1206. redeb = true
  1207. if coins - 10000000 * (rebirths + 1) >= 0 then
  1208. game.Workspace.RemoteEvent:FireServer("Rebirth")
  1209. currentFrame = ""
  1210. displayCurrent()
  1211. else
  1212. changeText(script.Parent.PurchaseFrame.Title, "Coins")
  1213. script.Parent.PurchaseFrame.Coins.Visible = true
  1214. script.Parent.PurchaseFrame.Passes.Visible = false
  1215. currentFrame = "PurchaseFrame"
  1216. displayCurrent()
  1217. end
  1218. wait(0.25)
  1219. redeb = false
  1220. end)
  1221. script.Parent.Rebirth.Close.MouseButton1Down:connect(function()
  1222. currentFrame = ""
  1223. displayCurrent()
  1224. end)
  1225. script.Parent.JoinGroup.Okay.MouseButton1Down:connect(function()
  1226. currentFrame = ""
  1227. displayCurrent()
  1228. end)
  1229. script.Parent.JoinGroup.Close.MouseButton1Down:connect(function()
  1230. currentFrame = ""
  1231. displayCurrent()
  1232. end)
  1233. script.Parent.InventoryFrame.Close.MouseButton1Down:connect(function()
  1234. currentFrame = ""
  1235. displayCurrent()
  1236. end)
  1237. function updateXbox()
  1238. local can = currentFrame ~= "BackpackFull" and currentFrame ~= "OpenShop" and currentFrame ~= "BetterTool" and currentFrame ~= "CollapsedCave" and currentFrame ~= "JoinGroup" and currentFrame ~= "Customize"
  1239. local frames = {
  1240. script.Parent.PurchaseFrame,
  1241. script.Parent.BackpackFull,
  1242. script.Parent.OpenShop,
  1243. script.Parent.BetterTool,
  1244. script.Parent.CollapsedCave,
  1245. script.Parent.JoinGroup,
  1246. script.Parent.Customize,
  1247. script.Parent.ShopFrame,
  1248. script.Parent.CratesFrame,
  1249. script.Parent.InventoryFrame
  1250. }
  1251. local function recurse(parent, var)
  1252. for a, b in pairs(parent:GetChildren()) do
  1253. do
  1254. local can = pcall(function()
  1255. local thing = b.Selectable
  1256. end)
  1257. if can then
  1258. if b.Name == "XboxButton" then
  1259. b.Visible = var
  1260. end
  1261. recurse(b, var)
  1262. end
  1263. end
  1264. end
  1265. end
  1266. script.Parent.StatsFrame.SubButtons.Twitter.Visible = not onXbox
  1267. script.Parent.StatsFrame.SubButtons.Rebirth.XboxButton.Visible = onXbox
  1268. script.Parent.StatsFrame.SubButtons.InventoryFrame.XboxButton.Visible = onXbox
  1269. for a, b in pairs(script.Parent.MainButtons:GetChildren()) do
  1270. if b:IsA("TextButton") then
  1271. if onXbox == false then
  1272. b.Visible = true
  1273. if b:FindFirstChild("XboxButton") then
  1274. b.XboxButton.Visible = false
  1275. end
  1276. elseif b:FindFirstChild("XboxButton") then
  1277. b.Visible = true
  1278. b.XboxButton.Visible = true
  1279. else
  1280. b.Visible = false
  1281. end
  1282. end
  1283. end
  1284. for i = 1, #frames do
  1285. recurse(frames[i], onXbox)
  1286. end
  1287. end
  1288. uis.GamepadConnected:connect(function()
  1289. onXbox = true
  1290. updateXbox()
  1291. end)
  1292. uis.GamepadDisconnected:connect(function()
  1293. onXbox = false
  1294. updateXbox()
  1295. end)
  1296. uis.InputBegan:connect(function(input)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement