| |
|
| |
|
| |
|
| | local Players = game:GetService("Players")
|
| | local UserInputService = game:GetService("UserInputService")
|
| | local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
| |
|
| | local player = Players.LocalPlayer
|
| | local EconomyConfig = require(ReplicatedStorage:WaitForChild("Shared"):WaitForChild("EconomyConfig"))
|
| | local Utility = require(ReplicatedStorage:WaitForChild("Shared"):WaitForChild("Utility"))
|
| | local MarketUpdateEvent = ReplicatedStorage:WaitForChild("Events"):WaitForChild("MarketUpdateEvent")
|
| |
|
| | local screenGui = Instance.new("ScreenGui")
|
| | screenGui.Name = "MarketGUI"
|
| | screenGui.ResetOnSpawn = false
|
| | screenGui.Parent = player:WaitForChild("PlayerGui")
|
| |
|
| | local mainFrame = Instance.new("Frame")
|
| | mainFrame.Name = "MarketFrame"
|
| | mainFrame.Size = UDim2.new(0, 300, 0, 380)
|
| | mainFrame.Position = UDim2.new(0, 10, 0.5, -190)
|
| | mainFrame.BackgroundColor3 = Color3.fromRGB(20, 25, 30)
|
| | mainFrame.BackgroundTransparency = 0.1
|
| | mainFrame.BorderSizePixel = 0
|
| | mainFrame.Visible = false
|
| | mainFrame.Parent = screenGui
|
| |
|
| | local frameCorner = Instance.new("UICorner")
|
| | frameCorner.CornerRadius = UDim.new(0, 12)
|
| | frameCorner.Parent = mainFrame
|
| |
|
| | local frameStroke = Instance.new("UIStroke")
|
| | frameStroke.Color = Color3.fromRGB(200, 160, 60)
|
| | frameStroke.Thickness = 2
|
| | frameStroke.Parent = mainFrame
|
| |
|
| | local titleBar = Instance.new("Frame")
|
| | titleBar.Size = UDim2.new(1, 0, 0, 35)
|
| | titleBar.BackgroundColor3 = Color3.fromRGB(150, 120, 30)
|
| | titleBar.BorderSizePixel = 0
|
| | titleBar.Parent = mainFrame
|
| |
|
| | local titleCorner = Instance.new("UICorner")
|
| | titleCorner.CornerRadius = UDim.new(0, 12)
|
| | titleCorner.Parent = titleBar
|
| |
|
| | local titleLabel = Instance.new("TextLabel")
|
| | titleLabel.Size = UDim2.new(1, -50, 1, 0)
|
| | titleLabel.Position = UDim2.new(0, 10, 0, 0)
|
| | titleLabel.BackgroundTransparency = 1
|
| | titleLabel.Text = "Market Prices"
|
| | titleLabel.TextColor3 = Color3.new(1, 1, 1)
|
| | titleLabel.TextScaled = true
|
| | titleLabel.Font = Enum.Font.GothamBold
|
| | titleLabel.TextXAlignment = Enum.TextXAlignment.Left
|
| | titleLabel.Parent = titleBar
|
| |
|
| | local closeBtn = Instance.new("TextButton")
|
| | closeBtn.Size = UDim2.new(0, 28, 0, 28)
|
| | closeBtn.Position = UDim2.new(1, -32, 0, 3)
|
| | closeBtn.BackgroundColor3 = Color3.fromRGB(180, 50, 50)
|
| | closeBtn.Text = "X"
|
| | closeBtn.TextColor3 = Color3.new(1, 1, 1)
|
| | closeBtn.TextScaled = true
|
| | closeBtn.Font = Enum.Font.GothamBold
|
| | closeBtn.Parent = titleBar
|
| |
|
| | local closeCorner = Instance.new("UICorner")
|
| | closeCorner.CornerRadius = UDim.new(0, 6)
|
| | closeCorner.Parent = closeBtn
|
| |
|
| | closeBtn.MouseButton1Click:Connect(function()
|
| | mainFrame.Visible = false
|
| | end)
|
| |
|
| | local scrollFrame = Instance.new("ScrollingFrame")
|
| | scrollFrame.Size = UDim2.new(1, -16, 1, -45)
|
| | scrollFrame.Position = UDim2.new(0, 8, 0, 38)
|
| | scrollFrame.BackgroundTransparency = 1
|
| | scrollFrame.BorderSizePixel = 0
|
| | scrollFrame.ScrollBarThickness = 5
|
| | scrollFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
|
| | scrollFrame.Parent = mainFrame
|
| |
|
| | local listLayout = Instance.new("UIListLayout")
|
| | listLayout.SortOrder = Enum.SortOrder.LayoutOrder
|
| | listLayout.Padding = UDim.new(0, 3)
|
| | listLayout.Parent = scrollFrame
|
| |
|
| |
|
| | local previousRates = {}
|
| |
|
| | local function updateMarketDisplay(rates)
|
| |
|
| | for _, child in pairs(scrollFrame:GetChildren()) do
|
| | if child:IsA("Frame") then child:Destroy() end
|
| | end
|
| |
|
| | local idx = 0
|
| | for woodType, rate in pairs(rates) do
|
| | idx = idx + 1
|
| | local baseValue = EconomyConfig.WoodBaseValues[woodType] or 0
|
| | local currentPrice = math.floor(baseValue * rate)
|
| |
|
| | local prevRate = previousRates[woodType] or 1.0
|
| | local trend = ""
|
| | local trendColor = Color3.new(1, 1, 1)
|
| | if rate > prevRate + 0.01 then
|
| | trend = " ^"
|
| | trendColor = Color3.fromRGB(100, 255, 100)
|
| | elseif rate < prevRate - 0.01 then
|
| | trend = " v"
|
| | trendColor = Color3.fromRGB(255, 100, 100)
|
| | else
|
| | trend = " ="
|
| | trendColor = Color3.fromRGB(200, 200, 200)
|
| | end
|
| |
|
| | local row = Instance.new("Frame")
|
| | row.Size = UDim2.new(1, 0, 0, 22)
|
| | row.LayoutOrder = idx
|
| | row.BackgroundColor3 = idx % 2 == 0 and Color3.fromRGB(30, 33, 40) or Color3.fromRGB(25, 28, 35)
|
| | row.BorderSizePixel = 0
|
| | row.Parent = scrollFrame
|
| |
|
| | local rowCorner = Instance.new("UICorner")
|
| | rowCorner.CornerRadius = UDim.new(0, 4)
|
| | rowCorner.Parent = row
|
| |
|
| | local nameLabel = Instance.new("TextLabel")
|
| | nameLabel.Size = UDim2.new(0.45, 0, 1, 0)
|
| | nameLabel.Position = UDim2.new(0, 5, 0, 0)
|
| | nameLabel.BackgroundTransparency = 1
|
| | nameLabel.Text = woodType
|
| | nameLabel.TextColor3 = Color3.new(1, 1, 1)
|
| | nameLabel.TextScaled = true
|
| | nameLabel.Font = Enum.Font.GothamMedium
|
| | nameLabel.TextXAlignment = Enum.TextXAlignment.Left
|
| | nameLabel.Parent = row
|
| |
|
| | local priceLabel = Instance.new("TextLabel")
|
| | priceLabel.Size = UDim2.new(0.3, 0, 1, 0)
|
| | priceLabel.Position = UDim2.new(0.45, 0, 0, 0)
|
| | priceLabel.BackgroundTransparency = 1
|
| | priceLabel.Text = "$" .. tostring(currentPrice) .. "/vol"
|
| | priceLabel.TextColor3 = Color3.fromRGB(255, 215, 0)
|
| | priceLabel.TextScaled = true
|
| | priceLabel.Font = Enum.Font.GothamMedium
|
| | priceLabel.Parent = row
|
| |
|
| | local trendLabel = Instance.new("TextLabel")
|
| | trendLabel.Size = UDim2.new(0.2, 0, 1, 0)
|
| | trendLabel.Position = UDim2.new(0.78, 0, 0, 0)
|
| | trendLabel.BackgroundTransparency = 1
|
| | trendLabel.Text = string.format("%.0f%%", rate * 100) .. trend
|
| | trendLabel.TextColor3 = trendColor
|
| | trendLabel.TextScaled = true
|
| | trendLabel.Font = Enum.Font.GothamBold
|
| | trendLabel.Parent = row
|
| | end
|
| |
|
| | previousRates = rates
|
| |
|
| | task.wait()
|
| | scrollFrame.CanvasSize = UDim2.new(0, 0, 0, listLayout.AbsoluteContentSize.Y + 10)
|
| | end
|
| |
|
| |
|
| | MarketUpdateEvent.OnClientEvent:Connect(function(rates)
|
| | updateMarketDisplay(rates)
|
| | end)
|
| |
|
| |
|
| | UserInputService.InputBegan:Connect(function(input, gameProcessed)
|
| | if gameProcessed then return end
|
| | if input.KeyCode == Enum.KeyCode.M then
|
| | mainFrame.Visible = not mainFrame.Visible
|
| | end
|
| | end)
|
| |
|