Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Updated by el1te
- if game.CoreGui:FindFirstChild("TNFSHOP") then
- game.CoreGui:FindFirstChild("TNFSHOP"):Destroy()
- end
- local Players = game:GetService("Players")
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local Remote = ReplicatedStorage:WaitForChild("Resources"):WaitForChild("Remotes"):WaitForChild("ClientRequest")
- local Directory = {
- ["generalStore1"] = {
- "Wooden chest",
- "Flintlock ball",
- "Model 1777",
- "Bandage",
- "Bread",
- "Dual pistol",
- "Blunderbuss",
- "Charleville musket",
- "Kentucky rifle",
- "Bedroll",
- "Hungarian axe pistol",
- "Faction uniform",
- "Marksman rifle",
- "Bullet",
- "Pocket watch",
- "Simple iron knife",
- "Lantern",
- "Fishing pole",
- "Pickaxe",
- "Torch",
- "Compass",
- "Spyglass"
- },
- ["illegalSupplies"] = {
- "Two-barrel musket",
- "Denix pistol",
- "War axe",
- "Long pistol"
- },
- ["tailor"] = {
- "Glasses",
- "Deluxe bandana"
- },
- ["barberShop"] = {
- ["Spanish helmet"] = game:GetService("Workspace").World.Operables["Hudson Bay Tailorship"]["Spanish helmet"],
- ["Seafarer"] = game:GetService("Workspace").World.Operables["Hudson Bay Tailorship"].Seafarer
- },
- ["travelSupplies"] = {
- "Large knapsack"
- },
- ["eventshop"] = {
- "Faction scarf"
- }
- }
- local function PurchaseItem(shop, item, quantity, itemLocation)
- local quantity = quantity or 1
- if itemLocation then
- return Remote:InvokeServer("purchaseItem", shop, item, quantity, itemLocation)
- else
- return Remote:InvokeServer("purchaseItem", shop, item, quantity)
- end
- end
- local function SellItem()
- end
- local function Drag(frame)
- local UserInputService = game:GetService("UserInputService")
- local gui = frame
- local dragging
- local dragInput
- local dragStart
- local startPos
- local function update(input)
- local delta = input.Position - dragStart
- gui.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
- end
- gui.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
- dragging = true
- dragStart = input.Position
- startPos = gui.Position
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- dragging = false
- end
- end)
- end
- end)
- gui.InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
- dragInput = input
- end
- end)
- UserInputService.InputChanged:Connect(function(input)
- if input == dragInput and dragging then
- update(input)
- end
- end)
- end
- local MainGui = Instance.new("ScreenGui")
- MainGui.Name = "TNFSHOP"
- MainGui.ResetOnSpawn = false
- local TopBar = Instance.new("Frame")
- TopBar.Name = "TopBar"
- TopBar.Position = UDim2.new()
- TopBar.Size = UDim2.new(0, 300, 0, 30)
- -- change top bar color below
- TopBar.BackgroundColor3 = Color3.fromRGB(128, 128, 128)
- -- change top bar color above
- TopBar.BorderSizePixel = 0
- TopBar.Active = true
- TopBar.Draggable = false
- TopBar.Parent = MainGui
- Drag(TopBar)
- local CloseButton = Instance.new("TextButton")
- CloseButton.Name = "CloseButton"
- CloseButton.Position = UDim2.new(1, -30, 0, 0)
- CloseButton.Size = UDim2.new(0, 30, 0, 30)
- CloseButton.BackgroundColor3 = Color3.fromRGB(128, 128, 128)
- CloseButton.BorderSizePixel = 0
- CloseButton.TextSize = 15
- CloseButton.Text = "X"
- CloseButton.Parent = TopBar
- local Frame = Instance.new("ScrollingFrame")
- Frame.Name = "ShopFrame"
- Frame.CanvasSize = UDim2.new(0, 300, 0, 1100)
- Frame.Position = UDim2.new(0, 0, 0, 30)
- Frame.Size = UDim2.new(0, 300, 0, 500)
- -- change frame color below
- Frame.BackgroundColor3 = Color3.fromRGB(128, 128, 128)
- -- change frame color above
- Frame.BorderSizePixel = 0
- Frame.ScrollBarImageColor3 = Color3.fromRGB(0, 0, 0)
- Frame.Active = true
- Frame.Draggable = false
- Frame.Parent = TopBar
- local Layout = Instance.new("UIListLayout")
- Layout.HorizontalAlignment = Enum.HorizontalAlignment.Center
- Layout.Padding = UDim.new(0, 10)
- Layout.Parent = Frame
- local ItemsCreated = 0
- local function AddItem(itemName, shop, defaultquantity, func, itemLocation)
- ItemsCreated = ItemsCreated + 1
- if not defaultquantity then defaultquantity = 1 end
- local ItemFrame = Instance.new("Frame")
- ItemFrame.Name = itemName
- ItemFrame.BorderSizePixel = 0
- ItemFrame.Size = UDim2.new(0, 240, 0, 80)
- local ItemLabel = Instance.new("TextLabel")
- ItemLabel.Name = "ItemLabel"
- ItemLabel.Text = itemName
- ItemLabel.Position = UDim2.new(0, 3, 0, 0)
- ItemLabel.Size = UDim2.new(0, 230, 0, 20)
- ItemLabel.BorderSizePixel = 0
- ItemLabel.TextXAlignment = Enum.TextXAlignment.Left
- ItemLabel.Parent = ItemFrame
- local ItemQuantity = Instance.new("TextBox")
- ItemQuantity.Name = "ItemQuantity"
- ItemQuantity.Text = tostring(defaultquantity)
- ItemQuantity.TextSize = 20
- ItemQuantity.Size = UDim2.new(0, 100, 0, 40)
- ItemQuantity.Position = UDim2.new(0, 20, 0, 30)
- ItemQuantity.Parent = ItemFrame
- local ItemPurchase = Instance.new("TextButton")
- ItemPurchase.Name = "ItemPurchase"
- ItemPurchase.Text = "Purchase"
- ItemPurchase.TextSize = 15
- ItemPurchase.Size = UDim2.new(0, 100, 0 , 40)
- ItemPurchase.Position = UDim2.new(0, 120, 0, 30)
- ItemPurchase.Parent = ItemFrame
- local func = func or function()
- local quantity = tonumber(ItemQuantity.Text) or 1
- local response = PurchaseItem(shop, itemName, quantity, itemLocation)
- end
- ItemPurchase.MouseButton1Click:Connect(func)
- ItemFrame.Parent = Frame
- return ItemFrame
- end
- for shopName, v in pairs(Directory) do
- if shopName == "barberShop" then
- for itemName, itemLocation in pairs(v) do
- AddItem(itemName, shopName, 1, nil, itemLocation)
- end
- else
- for i, itemName in ipairs(v) do
- AddItem(itemName, shopName, 1)
- end
- end
- end
- Frame.CanvasSize = UDim2.new(0, 300, 0, 90 * ItemsCreated)
- local Closed = false
- CloseButton.MouseButton1Click:Connect(function()
- if not Closed then
- Closed = true
- Frame.Parent = nil
- TopBar.Size = UDim2.new(0, 45, 0, 45)
- CloseButton.Position = UDim2.new(0.5, -15, 0.5, -15)
- elseif Closed then
- Closed = false
- TopBar.Size = UDim2.new(0, 300, 0, 30)
- CloseButton.Position = UDim2.new(1, -30, 0, 0)
- Frame.Parent = TopBar
- end
- end)
- MainGui.Parent = game.CoreGui
- wait()
- MainGui.AncestryChanged:Connect(function(_, parent)
- if not parent then
- script:Destroy()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement