Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Synapse Decompiler
- -- Purchase Here: https://brack4712.xyz/synapse/purchase/
- local players = game:GetService("Players")
- local localPlayer = players.LocalPlayer
- local marketplaceService = game:GetService("MarketplaceService")
- local replicatedStorage = game:GetService("ReplicatedStorage")
- local re = replicatedStorage:WaitForChild("RemoteEvents")
- local cas = game:GetService("ContextActionService")
- local devMode = false
- local groupId = 2856593
- local shopItems = workspace:WaitForChild("ShovelShop"):WaitForChild("ShopItems")
- local currentItem = localPlayer.Character:WaitForChild("ShopCameraScript"):WaitForChild("focusOn")
- local shopContainer = script.Parent:WaitForChild("ShopContainer")
- local leftButton = shopContainer.LeftButton
- local rightButton = shopContainer.RightButton
- local buyButton = shopContainer.BtnFrame.BuyButton
- local closeButton = shopContainer.CloseButton
- local descContainer = script.Parent:WaitForChild("DescriptionContainer")
- local description = descContainer.InnerContainer.description
- local invalidColor = Color3.fromRGB(27, 136, 194)
- local validColor = Color3.fromRGB(255, 255, 255)
- local totalItems = #shopItems:GetChildren()
- game:GetService("StarterGui"):SetCoreGuiEnabled(2, false)
- local ownedTools = {}
- local storedTools = {}
- local function hasProduct(product)
- local products = players:FindFirstChild(localPlayer.Name).Products.Value
- for i, v in string.gmatch(products, "([^,]+)") do
- if tonumber(i) == product then
- return true
- end
- end
- return false
- end
- function RefreshOwnedTools()
- local tools = localPlayer.Stats.tools.Value
- ownedTools = {}
- for i, v in string.gmatch(tools, "([^,]+)") do
- table.insert(ownedTools, i)
- end
- return
- end
- RefreshOwnedTools()
- local controllerType = localPlayer.controllerType.Value
- function RefreshStoredTools()
- local sTools = localPlayer.Stats.storedTools.Value
- if string.len(sTools) > 0 then
- storedTools = {}
- for i, v in string.gmatch(sTools, "([^,]+)") do
- table.insert(storedTools, i)
- end
- end
- end
- RefreshStoredTools()
- currentItem.Value = shopItems["1"]
- function CheckIfOwned(toolName)
- RefreshOwnedTools()
- for i, v in pairs(ownedTools) do
- if v == toolName then
- return true
- end
- end
- return false
- end
- function CheckIfStored(toolName)
- RefreshStoredTools()
- for i, v in pairs(storedTools) do
- if v == toolName then
- return true
- end
- end
- return false
- end
- function CheckIfHave()
- for i, v in pairs(localPlayer.Backpack:GetChildren()) do
- if v.Name == currentItem.Value.name.Value then
- return true
- end
- end
- for i, v in pairs(workspace[localPlayer.Name]:GetChildren()) do
- if v:IsA("Tool") and v.Name == currentItem.Value.name.Value then
- return true
- end
- end
- return false
- end
- local atLeft = false
- local atRight = false
- local alreadyOwned = false
- local hasEnoughMoney = false
- local isGroupItem = false
- local isDevItem = false
- local isInGroup = false
- local hasItem = false
- local isStored = false
- local buttonImages = {
- "rbxassetid://1268441248",
- "rbxassetid://1275216518"
- }
- function UpdateDisplay()
- atLeft = false
- atRight = false
- alreadyOwned = CheckIfOwned(currentItem.Value.name.Value)
- isStored = CheckIfStored(currentItem.Value.name.Value)
- hasEnoughMoney = localPlayer.leaderstats.Money.Value >= currentItem.Value.price.Value
- hasItem = CheckIfHave()
- isGroupItem = currentItem.Value:FindFirstChild("Group") and true or false
- isDevItem = currentItem.Value:FindFirstChild("RD") and true or false
- isInGroup = localPlayer:IsInGroup(groupId)
- if devMode then
- print("============================")
- end
- if devMode then
- print("is in group: ", isInGroup)
- end
- if devMode then
- print("is group item: ", isGroupItem)
- end
- if devMode then
- print("is Dev Item: ", isDevItem)
- end
- if devMode then
- print("has Enough Money: ", hasEnoughMoney)
- end
- if devMode then
- print("Already Owned: ", alreadyOwned)
- end
- if controllerType == 0 then
- script.Parent.ControllerButtons.Visible = false
- elseif controllerType == 1 then
- script.Parent.ControllerButtons.Visible = true
- script.Parent.ControllerButtons.Visible = true
- end
- if tonumber(currentItem.Value.Name) == 1 then
- if devMode then
- print("at Left")
- end
- atLeft = true
- leftButton.TextColor3 = invalidColor
- leftButton:TweenPosition(UDim2.new(leftButton.Position.X.Scale, leftButton.Position.X.Offset, 0, leftButton.Position.Y.Offset), "In", "Quart", 0.1, true)
- elseif not atLeft then
- if devMode then
- print("not Left")
- end
- atLeft = false
- leftButton.TextColor3 = validColor
- leftButton:TweenPosition(UDim2.new(leftButton.Position.X.Scale, leftButton.Position.X.Offset, -0.1, leftButton.Position.Y.Offset), "In", "Quart", 0.1, true)
- end
- if tonumber(currentItem.Value.Name) == totalItems then
- if devMode then
- print("at Right")
- end
- atRight = true
- rightButton.TextColor3 = invalidColor
- rightButton:TweenPosition(UDim2.new(rightButton.Position.X.Scale, rightButton.Position.X.Offset, 0, rightButton.Position.Y.Offset), "In", "Quart", 0.1, true)
- elseif not atRight then
- if devMode then
- print("not Right")
- end
- atRight = false
- rightButton.TextColor3 = validColor
- rightButton:TweenPosition(UDim2.new(rightButton.Position.X.Scale, rightButton.Position.X.Offset, -0.1, rightButton.Position.Y.Offset), "In", "Quart", 0.1, true)
- end
- if not isDevItem and not isGroupItem and not isStored and not hasItem then
- shopContainer.ItemName.Text = currentItem.Value.name.Value
- shopContainer.ItemPrice.Text = "$" .. currentItem.Value.price.Value
- description.Text = currentItem.Value.description.Value
- elseif isStored or hasItem then
- shopContainer.ItemName.Text = currentItem.Value.name.Value
- shopContainer.ItemPrice.Text = "Free!"
- description.Text = currentItem.Value.description.Value
- elseif not isDevItem and isGroupItem then
- description.Text = currentItem.Value.description.Value
- if isInGroup and currentItem.Value.price.Value == 0 then
- shopContainer.ItemName.Text = currentItem.Value.name.Value
- shopContainer.ItemPrice.Text = "Free!"
- elseif not isInGroup then
- shopContainer.ItemName.Text = currentItem.Value.name.Value
- shopContainer.ItemPrice.Text = "Group Only!"
- else
- shopContainer.ItemName.Text = currentItem.Value.name.Value
- shopContainer.ItemPrice.Text = "$" .. currentItem.Value.price.Value
- buyButton.TextLabel.Text = "Buy"
- end
- elseif isDevItem and not isGroupItem then
- shopContainer.ItemName.Text = currentItem.Value.name.Value
- shopContainer.ItemPrice.Text = currentItem.Value.price.Value .. "R$"
- description.Text = marketplaceService:GetProductInfo(currentItem.Value.RD.Value, Enum.InfoType.Product).Description
- end
- 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
- buyButton.TextLabel.Text = "Buy"
- buyButton.TextLabel.TextColor3 = validColor
- 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)
- 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
- buyButton.TextLabel.Text = "Not enough money!"
- buyButton.TextLabel.TextColor3 = invalidColor
- 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)
- elseif hasItem then
- buyButton.TextLabel.Text = "Store Item"
- buyButton.TextLabel.TextColor3 = validColor
- 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)
- elseif isStored and not hasItem then
- buyButton.TextLabel.Text = "Take Item"
- buyButton.TextLabel.TextColor3 = validColor
- 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)
- end
- end
- UpdateDisplay()
- function LeftButtonClicked()
- if tonumber(currentItem.Value.Name) == 1 then
- UpdateDisplay()
- else
- local nextItem = tonumber(currentItem.Value.Name) - 1
- currentItem.Value = shopItems[tostring(nextItem)]
- UpdateDisplay()
- end
- end
- function RightButtonClicked()
- if tonumber(currentItem.Value.Name) == totalItems then
- UpdateDisplay()
- else
- local nextItem = tonumber(currentItem.Value.Name) + 1
- currentItem.Value = shopItems[tostring(nextItem)]
- UpdateDisplay()
- end
- end
- function BuyButtonClicked()
- if buyButton.TextLabel.Text == "Buy" then
- if not (not hasEnoughMoney or isDevItem) or currentItem.Value:FindFirstChild("RDOR") and hasEnoughMoney then
- re.BuyShovel:FireServer(currentItem.Value.name.Value)
- elseif not currentItem.Value:FindFirstChild("RDOR") then
- marketplaceService:PromptProductPurchase(localPlayer, currentItem.Value.RD.Value)
- buyButton.TextLabel.TextColor3 = invalidColor
- 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)
- else
- marketplaceService:PromptProductPurchase(localPlayer, currentItem.Value.RDOR.Value)
- buyButton.TextLabel.TextColor3 = invalidColor
- 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)
- end
- elseif buyButton.TextLabel.Text == "Take Item" then
- re.RetrieveItem:FireServer(currentItem.Value.name.Value)
- elseif buyButton.TextLabel.Text == "Store Item" then
- re.StoreItem:FireServer(currentItem.Value.name.Value)
- end
- wait(0.5)
- UpdateDisplay()
- end
- function CloseButtonClicked()
- game:GetService("StarterGui"):SetCoreGuiEnabled(2, true)
- game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
- game.Workspace.CurrentCamera.CameraType = "Custom"
- localPlayer.Character:FindFirstChild("ShopCameraScript"):Destroy()
- localPlayer.PlayerScripts:FindFirstChild("ControlScript").Disabled = false
- if hasProduct(125071079) then
- players.LocalPlayer.Character.Humanoid.WalkSpeed = 32
- else
- players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
- end
- localPlayer.isInGui.Value = false
- script.Parent:Destroy()
- end
- function InteractionHandler(actionName, state, inputObject)
- if state == Enum.UserInputState.Begin then
- if actionName == "RightButton" then
- RightButtonClicked()
- elseif actionName == "LeftButton" then
- LeftButtonClicked()
- elseif actionName == "BButton" then
- BuyButtonClicked()
- elseif actionName == "YButton" then
- CloseButtonClicked()
- end
- end
- end
- re.UpdateDisplay.OnClientEvent:connect(function()
- UpdateDisplay()
- end)
- leftButton.MouseButton1Click:connect(LeftButtonClicked)
- rightButton.MouseButton1Click:connect(RightButtonClicked)
- closeButton.MouseButton1Click:connect(CloseButtonClicked)
- buyButton.MouseButton1Click:connect(BuyButtonClicked)
- cas:BindAction("RightButton", InteractionHandler, false, Enum.KeyCode.ButtonR1)
- cas:BindAction("LeftButton", InteractionHandler, false, Enum.KeyCode.ButtonL1)
- cas:BindAction("BButton", InteractionHandler, false, Enum.KeyCode.ButtonB)
- cas:BindAction("YButton", InteractionHandler, false, Enum.KeyCode.ButtonY)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement