Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --SynapseX Decompiler
- StoreData = {}
- StorePos = Vector3.new(0, 0, 0)
- lastClick = 0
- lastButton = nil
- lastPurchase = 0
- function checkPlaceOk()
- if game.PlaceId == 198116126 or game.PlaceId == 72740039 then
- return true
- else
- return false
- end
- end
- function CloseOutOfRange()
- while wait(0.5) do
- if (game.Players.LocalPlayer.Character.Head.Position - StorePos).magnitude > 100 or script.Parent.Store.Visible == false then
- script.Parent.Store.Visible = false
- break
- end
- end
- end
- function Purchase(itemData, p)
- if workspace.DistributedGameTime - lastPurchase > 1 then
- lastPurchase = workspace.DistributedGameTime
- if itemData[6] == 0 then
- game.ReplicatedStorage.RemoteFunctionz.Environment.RequestPurchase:FireServer(itemData)
- elseif itemData[6] == 1 and game.PlaceId ~= 420777178 then
- game.ReplicatedStorage.RemoteFunctionz.Environment.RequestCargoPurchase:FireServer(itemData[1], itemData[3], p)
- elseif itemData[6] == 2 and checkPlaceOk() then
- game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, itemData[7])
- elseif itemData[6] == 3 and checkPlaceOk() then
- game:GetService("MarketplaceService"):PromptPurchase(game.Players.LocalPlayer, itemData[7])
- elseif itemData[6] == 4 then
- game.ReplicatedStorage.RemoteFunctionz.Environment.RequestShipRedeem:FireServer(itemData[1], itemData[3], itemData[4], itemData[5])
- else
- return
- end
- end
- end
- function Clicked(button, desc)
- lastButton = button
- script.Parent.Store.Frame.ItemName.Text = button.Item_Name.Text
- if not string.sub(button.Item_Name.Text, string.len(button.Item_Name.Text)) == ")" and not string.find(button.Item_Name.Text, "100K") and tonumber(button.Quantity.Text) > 1 then
- script.Parent.Store.Frame.ItemName.Text = button.Item_Name.Text .. " (x" .. button.Quantity.Text .. ")"
- end
- script.Parent.Store.Frame.ItemDesc.Text = desc or ""
- script.Parent.Store.Frame.Price.Text = button.Price.Text
- script.Parent.Store.Frame.Price_Image.Image = button.Price_Image.Image
- script.Parent.Store.Frame.Price_Image.Visible = true
- script.Parent.Store.Frame.Buy.Visible = true
- end
- script.Parent.Store.Frame.Buy.MouseButton1Down:connect(function()
- Purchase(StoreData[lastButton.StoreIndex.Value], tonumber(lastButton.Price.Text))
- end)
- script.Parent.OpenStore.Event:connect(function(storeId, storePos)
- local storeData = game.ReplicatedStorage.RemoteFunctionz.Environment.GetStoreData:InvokeServer(storeId)
- if not storeData then
- return
- end
- StoreData = storeData
- StorePos = storePos
- script.Parent.Store.Frame.ItemName.Text = ""
- script.Parent.Store.Frame.ItemDesc.Text = ""
- script.Parent.Store.Frame.Price.Text = ""
- script.Parent.Store.Frame.Buy.Visible = false
- script.Parent.Store.Frame.Price_Image.Visible = false
- local G = script.Parent.Store.ScrollingFrame:GetChildren()
- for g = 1, #G do
- if G[g].Name ~= "Template" then
- G[g]:Destroy()
- end
- end
- local multiplier = 1
- if string.find(storeId, "Trader") and game.Players.LocalPlayer.TeamColor == BrickColor.new("Black") then
- multiplier = 1.25
- end
- local nx = 0
- local ny = 0
- for index, vendor in pairs(storeData) do
- do
- local b = script.Parent.Store.ScrollingFrame.Template:clone()
- b.Name = "V" .. index
- b.StoreIndex.Value = index
- b.Item_Name.Text = vendor[8]
- b.Quantity.Text = vendor[2]
- local img = game.ReplicatedStorage.Icons:FindFirstChild(vendor[1])
- if vendor[6] == 1 then
- img = game.ReplicatedStorage.Icons.Crate
- elseif string.find(vendor[1], "Wheel") then
- img = game.ReplicatedStorage.Icons.Wheel
- elseif string.find(vendor[1], "Figurehead") then
- img = game.ReplicatedStorage.Icons.Figurehead
- elseif string.find(vendor[1], "Premium Token") then
- img = game.ReplicatedStorage.Icons["Premium Token"]
- end
- img = img or game.ReplicatedStorage.Icons.Missing_Item
- b.Item_Image.Image = img.Texture
- local img2 = game.ReplicatedStorage.Icons:FindFirstChild(vendor[3])
- img2 = img2 or game.ReplicatedStorage.Icons.Missing_Item
- b.Price_Image.Image = img2.Texture
- b.Price.Text = math.floor(vendor[4] * multiplier)
- b.Position = UDim2.new(0, nx * 180 + 5, 0, ny * b.Size.Y.Offset + 5)
- b.Parent = script.Parent.Store.ScrollingFrame
- b.Visible = true
- b.MouseButton1Down:connect(function()
- Clicked(b, vendor[9])
- end)
- nx = nx + 1
- if nx > 0 then
- ny = ny + 1
- nx = 0
- end
- end
- end
- script.Parent.Store.ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, ny * script.Parent.Store.ScrollingFrame.Template.Size.Y.Offset)
- script.Parent.Store.Visible = true
- coroutine.resume(coroutine.create(CloseOutOfRange))
- end)
- script.Parent.Store.Close.MouseButton1Down:connect(function()
- script.Parent.Store.Visible = false
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement