Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local parent = script.Parent
- local sample = script.Sample
- local player = game.Players.LocalPlayer
- local storage = game:GetService('ReplicatedStorage')
- local resources = storage:WaitForChild('Resources')
- local remotes = storage:WaitForChild('Remotes')
- local remote = remotes:WaitForChild('BlackMarket')
- local m = require(resources:WaitForChild('Blackmarket'))
- local desc = parent:WaitForChild('Desc')
- local main = parent:WaitForChild('Main')
- local holder = desc:WaitForChild('Holder')
- local exit = parent:WaitForChild('Exit')
- local item = desc:WaitForChild('Item')
- local deb = false
- local currentitem = nil
- local function clean()
- currentitem = nil
- holder.Owned.Text = 'Owned : '
- holder.Price.Text = 'Price : '
- holder.Type.Text = 'Type : '
- item.Text = ' '
- end
- local function exitEvent()
- if deb then return end
- deb = true
- clean()
- remote:FireServer('EXIT')
- wait(1)
- deb = false
- end
- exit.MouseButton1Click:Connect(exitEvent)
- local function purchaseEvent()
- if currentitem == nil then return end
- if deb then return end
- deb = true
- remote:FireServer('PURCHASE', currentitem)
- wait(1)
- local i = 0
- for e,d in pairs(player:WaitForChild('Backpack'):GetChildren())do
- if d.Name == currentitem then
- i = i+1
- end
- end
- holder.Owned.Text = 'Owned : '..tostring(i)
- wait(.5)
- deb = false
- end
- holder.Purchase.MouseButton1Click:Connect(purchaseEvent)
- for i,v in pairs(m.Items)do
- if main:FindFirstChild(v.name) then return end
- local c = sample:Clone()
- c.Text = v.name
- c.Name = v.name
- c.Parent = main
- c.MouseButton1Click:Connect(function()
- if deb then return end
- deb = true
- if c.Name == currentitem then
- currentitem = nil
- clean()
- else
- clean()
- currentitem = c.Name
- holder.Price.Text = 'Price : '..m.Items[c.Name]['price']
- item.Text = m.Items[c.Name]['name']
- holder.Type.Text = 'Type : '..m.Items[c.Name]['type']
- local i = 0
- for e,d in pairs(player:WaitForChild('Backpack'):GetChildren())do
- if d.Name == c.Name then
- i = i+1
- end
- end
- holder.Owned.Text = 'Owned : '..tostring(i)
- end
- wait(.2)
- deb = false
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement