Advertisement
Reversal00

mi

Feb 23rd, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.51 KB | None | 0 0
  1. -- Synapse Decompiler
  2. -- Purchase Here: https://brack4712.xyz/synapse/purchase/
  3.  
  4. local players = game:GetService("Players")
  5. local localPlayer = players.LocalPlayer
  6. local marketplaceService = game:GetService("MarketplaceService")
  7. local replicatedStorage = game:GetService("ReplicatedStorage")
  8. local re = replicatedStorage:WaitForChild("RemoteEvents")
  9. local cas = game:GetService("ContextActionService")
  10. local devMode = false
  11. local groupId = 2856593
  12. local shopItems = workspace:WaitForChild("ShovelShop"):WaitForChild("ShopItems")
  13. local currentItem = localPlayer.Character:WaitForChild("ShopCameraScript"):WaitForChild("focusOn")
  14. local shopContainer = script.Parent:WaitForChild("ShopContainer")
  15. local leftButton = shopContainer.LeftButton
  16. local rightButton = shopContainer.RightButton
  17. local buyButton = shopContainer.BtnFrame.BuyButton
  18. local closeButton = shopContainer.CloseButton
  19. local descContainer = script.Parent:WaitForChild("DescriptionContainer")
  20. local description = descContainer.InnerContainer.description
  21. local invalidColor = Color3.fromRGB(27, 136, 194)
  22. local validColor = Color3.fromRGB(255, 255, 255)
  23. local totalItems = #shopItems:GetChildren()
  24. game:GetService("StarterGui"):SetCoreGuiEnabled(2, false)
  25. local ownedTools = {}
  26. local storedTools = {}
  27. local function hasProduct(product)
  28. local products = players:FindFirstChild(localPlayer.Name).Products.Value
  29. for i, v in string.gmatch(products, "([^,]+)") do
  30. if tonumber(i) == product then
  31. return true
  32. end
  33. end
  34. return false
  35. end
  36. function RefreshOwnedTools()
  37. local tools = localPlayer.Stats.tools.Value
  38. ownedTools = {}
  39. for i, v in string.gmatch(tools, "([^,]+)") do
  40. table.insert(ownedTools, i)
  41. end
  42. return
  43. end
  44. RefreshOwnedTools()
  45. local controllerType = localPlayer.controllerType.Value
  46. function RefreshStoredTools()
  47. local sTools = localPlayer.Stats.storedTools.Value
  48. if string.len(sTools) > 0 then
  49. storedTools = {}
  50. for i, v in string.gmatch(sTools, "([^,]+)") do
  51. table.insert(storedTools, i)
  52. end
  53. end
  54. end
  55. RefreshStoredTools()
  56. currentItem.Value = shopItems["1"]
  57. function CheckIfOwned(toolName)
  58. RefreshOwnedTools()
  59. for i, v in pairs(ownedTools) do
  60. if v == toolName then
  61. return true
  62. end
  63. end
  64. return false
  65. end
  66. function CheckIfStored(toolName)
  67. RefreshStoredTools()
  68. for i, v in pairs(storedTools) do
  69. if v == toolName then
  70. return true
  71. end
  72. end
  73. return false
  74. end
  75. function CheckIfHave()
  76. for i, v in pairs(localPlayer.Backpack:GetChildren()) do
  77. if v.Name == currentItem.Value.name.Value then
  78. return true
  79. end
  80. end
  81. for i, v in pairs(workspace[localPlayer.Name]:GetChildren()) do
  82. if v:IsA("Tool") and v.Name == currentItem.Value.name.Value then
  83. return true
  84. end
  85. end
  86. return false
  87. end
  88. local atLeft = false
  89. local atRight = false
  90. local alreadyOwned = false
  91. local hasEnoughMoney = false
  92. local isGroupItem = false
  93. local isDevItem = false
  94. local isInGroup = false
  95. local hasItem = false
  96. local isStored = false
  97. local buttonImages = {
  98. "rbxassetid://1268441248",
  99. "rbxassetid://1275216518"
  100. }
  101. function UpdateDisplay()
  102. atLeft = false
  103. atRight = false
  104. alreadyOwned = CheckIfOwned(currentItem.Value.name.Value)
  105. isStored = CheckIfStored(currentItem.Value.name.Value)
  106. hasEnoughMoney = localPlayer.leaderstats.Money.Value >= currentItem.Value.price.Value
  107. hasItem = CheckIfHave()
  108. isGroupItem = currentItem.Value:FindFirstChild("Group") and true or false
  109. isDevItem = currentItem.Value:FindFirstChild("RD") and true or false
  110. isInGroup = localPlayer:IsInGroup(groupId)
  111. if devMode then
  112. print("============================")
  113. end
  114. if devMode then
  115. print("is in group: ", isInGroup)
  116. end
  117. if devMode then
  118. print("is group item: ", isGroupItem)
  119. end
  120. if devMode then
  121. print("is Dev Item: ", isDevItem)
  122. end
  123. if devMode then
  124. print("has Enough Money: ", hasEnoughMoney)
  125. end
  126. if devMode then
  127. print("Already Owned: ", alreadyOwned)
  128. end
  129. if controllerType == 0 then
  130. script.Parent.ControllerButtons.Visible = false
  131. elseif controllerType == 1 then
  132. script.Parent.ControllerButtons.Visible = true
  133. script.Parent.ControllerButtons.Visible = true
  134. end
  135. if tonumber(currentItem.Value.Name) == 1 then
  136. if devMode then
  137. print("at Left")
  138. end
  139. atLeft = true
  140. leftButton.TextColor3 = invalidColor
  141. leftButton:TweenPosition(UDim2.new(leftButton.Position.X.Scale, leftButton.Position.X.Offset, 0, leftButton.Position.Y.Offset), "In", "Quart", 0.1, true)
  142. elseif not atLeft then
  143. if devMode then
  144. print("not Left")
  145. end
  146. atLeft = false
  147. leftButton.TextColor3 = validColor
  148. leftButton:TweenPosition(UDim2.new(leftButton.Position.X.Scale, leftButton.Position.X.Offset, -0.1, leftButton.Position.Y.Offset), "In", "Quart", 0.1, true)
  149. end
  150. if tonumber(currentItem.Value.Name) == totalItems then
  151. if devMode then
  152. print("at Right")
  153. end
  154. atRight = true
  155. rightButton.TextColor3 = invalidColor
  156. rightButton:TweenPosition(UDim2.new(rightButton.Position.X.Scale, rightButton.Position.X.Offset, 0, rightButton.Position.Y.Offset), "In", "Quart", 0.1, true)
  157. elseif not atRight then
  158. if devMode then
  159. print("not Right")
  160. end
  161. atRight = false
  162. rightButton.TextColor3 = validColor
  163. rightButton:TweenPosition(UDim2.new(rightButton.Position.X.Scale, rightButton.Position.X.Offset, -0.1, rightButton.Position.Y.Offset), "In", "Quart", 0.1, true)
  164. end
  165. if not isDevItem and not isGroupItem and not isStored and not hasItem then
  166. shopContainer.ItemName.Text = currentItem.Value.name.Value
  167. shopContainer.ItemPrice.Text = "$" .. currentItem.Value.price.Value
  168. description.Text = currentItem.Value.description.Value
  169. elseif isStored or hasItem then
  170. shopContainer.ItemName.Text = currentItem.Value.name.Value
  171. shopContainer.ItemPrice.Text = "Free!"
  172. description.Text = currentItem.Value.description.Value
  173. elseif not isDevItem and isGroupItem then
  174. description.Text = currentItem.Value.description.Value
  175. if isInGroup and currentItem.Value.price.Value == 0 then
  176. shopContainer.ItemName.Text = currentItem.Value.name.Value
  177. shopContainer.ItemPrice.Text = "Free!"
  178. elseif not isInGroup then
  179. shopContainer.ItemName.Text = currentItem.Value.name.Value
  180. shopContainer.ItemPrice.Text = "Group Only!"
  181. else
  182. shopContainer.ItemName.Text = currentItem.Value.name.Value
  183. shopContainer.ItemPrice.Text = "$" .. currentItem.Value.price.Value
  184. buyButton.TextLabel.Text = "Buy"
  185. end
  186. elseif isDevItem and not isGroupItem then
  187. shopContainer.ItemName.Text = currentItem.Value.name.Value
  188. shopContainer.ItemPrice.Text = currentItem.Value.price.Value .. "R$"
  189. description.Text = marketplaceService:GetProductInfo(currentItem.Value.RD.Value, Enum.InfoType.Product).Description
  190. end
  191. if not ((isStored or alreadyOwned or isGroupItem or not hasEnoughMoney) and (not isDevItem or isStored or alreadyOwned)) or currentItem.Value:FindFirstChild("RDOR") and hasEnoughMoney and not alreadyOwned and not isStored then
  192. buyButton.TextLabel.Text = "Buy"
  193. buyButton.TextLabel.TextColor3 = validColor
  194. buyButton.Parent:TweenPosition(UDim2.new(buyButton.Parent.Position.X.Scale, buyButton.Parent.Position.X.Offset, 1.05, buyButton.Parent.Position.Y.Offset), "In", "Quart", 0.1, true)
  195. elseif not (isStored or isGroupItem or currentItem.Value.price.Value == 0 or isDevItem or hasEnoughMoney or currentItem.Value:FindFirstChild("RDOR") or alreadyOwned or hasItem) or isGroupItem and currentItem.Value.price.Value > 0 and not hasEnoughMoney then
  196. buyButton.TextLabel.Text = "Not enough money!"
  197. buyButton.TextLabel.TextColor3 = invalidColor
  198. buyButton.Parent:TweenPosition(UDim2.new(buyButton.Parent.Position.X.Scale, buyButton.Parent.Position.X.Offset, 1.15, buyButton.Parent.Position.Y.Offset), "In", "Quart", 0.1, true)
  199. elseif hasItem then
  200. buyButton.TextLabel.Text = "Store Item"
  201. buyButton.TextLabel.TextColor3 = validColor
  202. buyButton.Parent:TweenPosition(UDim2.new(buyButton.Parent.Position.X.Scale, buyButton.Parent.Position.X.Offset, 1.05, buyButton.Parent.Position.Y.Offset), "In", "Quart", 0.1, true)
  203. elseif isStored and not hasItem then
  204. buyButton.TextLabel.Text = "Take Item"
  205. buyButton.TextLabel.TextColor3 = validColor
  206. buyButton.Parent:TweenPosition(UDim2.new(buyButton.Parent.Position.X.Scale, buyButton.Parent.Position.X.Offset, 1.05, buyButton.Parent.Position.Y.Offset), "In", "Quart", 0.1, true)
  207. end
  208. end
  209. UpdateDisplay()
  210. function LeftButtonClicked()
  211. if tonumber(currentItem.Value.Name) == 1 then
  212. UpdateDisplay()
  213. else
  214. local nextItem = tonumber(currentItem.Value.Name) - 1
  215. currentItem.Value = shopItems[tostring(nextItem)]
  216. UpdateDisplay()
  217. end
  218. end
  219. function RightButtonClicked()
  220. if tonumber(currentItem.Value.Name) == totalItems then
  221. UpdateDisplay()
  222. else
  223. local nextItem = tonumber(currentItem.Value.Name) + 1
  224. currentItem.Value = shopItems[tostring(nextItem)]
  225. UpdateDisplay()
  226. end
  227. end
  228. function BuyButtonClicked()
  229. if buyButton.TextLabel.Text == "Buy" then
  230. if not (not hasEnoughMoney or isDevItem) or currentItem.Value:FindFirstChild("RDOR") and hasEnoughMoney then
  231. re.BuyShovel:FireServer(currentItem.Value.name.Value)
  232. elseif not currentItem.Value:FindFirstChild("RDOR") then
  233. marketplaceService:PromptProductPurchase(localPlayer, currentItem.Value.RD.Value)
  234. buyButton.TextLabel.TextColor3 = invalidColor
  235. buyButton.Parent:TweenPosition(UDim2.new(buyButton.Parent.Position.X.Scale, buyButton.Parent.Position.X.Offset, 1.15, buyButton.Parent.Position.Y.Offset), "In", "Quart", 0.1, true)
  236. else
  237. marketplaceService:PromptProductPurchase(localPlayer, currentItem.Value.RDOR.Value)
  238. buyButton.TextLabel.TextColor3 = invalidColor
  239. buyButton.Parent:TweenPosition(UDim2.new(buyButton.Parent.Position.X.Scale, buyButton.Parent.Position.X.Offset, 1.15, buyButton.Parent.Position.Y.Offset), "In", "Quart", 0.1, true)
  240. end
  241. elseif buyButton.TextLabel.Text == "Take Item" then
  242. re.RetrieveItem:FireServer(currentItem.Value.name.Value)
  243. elseif buyButton.TextLabel.Text == "Store Item" then
  244. re.StoreItem:FireServer(currentItem.Value.name.Value)
  245. end
  246. wait(0.5)
  247. UpdateDisplay()
  248. end
  249. function CloseButtonClicked()
  250. game:GetService("StarterGui"):SetCoreGuiEnabled(2, true)
  251. game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
  252. game.Workspace.CurrentCamera.CameraType = "Custom"
  253. localPlayer.Character:FindFirstChild("ShopCameraScript"):Destroy()
  254. localPlayer.PlayerScripts:FindFirstChild("ControlScript").Disabled = false
  255. if hasProduct(125071079) then
  256. players.LocalPlayer.Character.Humanoid.WalkSpeed = 32
  257. else
  258. players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
  259. end
  260. localPlayer.isInGui.Value = false
  261. script.Parent:Destroy()
  262. end
  263. function InteractionHandler(actionName, state, inputObject)
  264. if state == Enum.UserInputState.Begin then
  265. if actionName == "RightButton" then
  266. RightButtonClicked()
  267. elseif actionName == "LeftButton" then
  268. LeftButtonClicked()
  269. elseif actionName == "BButton" then
  270. BuyButtonClicked()
  271. elseif actionName == "YButton" then
  272. CloseButtonClicked()
  273. end
  274. end
  275. end
  276. re.UpdateDisplay.OnClientEvent:connect(function()
  277. UpdateDisplay()
  278. end)
  279. leftButton.MouseButton1Click:connect(LeftButtonClicked)
  280. rightButton.MouseButton1Click:connect(RightButtonClicked)
  281. closeButton.MouseButton1Click:connect(CloseButtonClicked)
  282. buyButton.MouseButton1Click:connect(BuyButtonClicked)
  283. cas:BindAction("RightButton", InteractionHandler, false, Enum.KeyCode.ButtonR1)
  284. cas:BindAction("LeftButton", InteractionHandler, false, Enum.KeyCode.ButtonL1)
  285. cas:BindAction("BButton", InteractionHandler, false, Enum.KeyCode.ButtonB)
  286. cas:BindAction("YButton", InteractionHandler, false, Enum.KeyCode.ButtonY)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement