local PRICE_PREFIX = "%s Credits" local BannerColors = { [true] = Color3.fromRGB(0, 255, 0); [false] = Color3.fromRGB(255, 0, 0); } ---- local Player = game.Players.LocalPlayer local UserId = Player.UserId local BuyRemote = game.ReplicatedStorage:WaitForChild("ShopBuy") local UIControl = { } local ButtonControl = { } if game:GetService("RunService"):IsServer() then return nil end -- Services -- local TweenService = game:GetService("TweenService") local Market = game:GetService("MarketplaceService") -- Resource -- local UtilModule = require(game.ReplicatedStorage:WaitForChild("Utils")) local GuiResource = game.ReplicatedStorage:WaitForChild("GuiResource") local ShopResource = GuiResource:WaitForChild("Shop") local SlotValues = require(game.ReplicatedStorage:WaitForChild("SmugglerPrices")) -- Gui Variables -- local ScreenGui = script:FindFirstAncestorOfClass("ScreenGui") local Main = ScreenGui:WaitForChild("Main") local Holder = Main:WaitForChild("Background"):WaitForChild("Holder") local Ghost = game.ReplicatedStorage:WaitForChild("GuiResource"):WaitForChild("Ghost") local GhostOffset = UDim2.new(0.18900001, 0, 0.309000015, 0) local QuintTweenInfo = TweenInfo.new(0.75, Enum.EasingStyle.Back, Enum.EasingDirection.In) local QuadTweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out) local ButtonTweenInfo = TweenInfo.new(0.35, Enum.EasingStyle.Quad, Enum.EasingDirection.Out) local Click = script:FindFirstAncestorOfClass("ScreenGui"):FindFirstChild("Click") -- Tween Sets -- local MainTweenOut = TweenService:Create(Main, QuintTweenInfo, { Size = UDim2.new(0, 0, 0, 0) }) local MainTweenIn = TweenService:Create(Main, QuadTweenInfo, { Size = UDim2.new(1, 0, 1, 0) }) ---- function UIControl:Setup() local StartingTick = tick() Main.Size = UDim2.new(0, 0, 0, 0) Main.Visible = false ScreenGui.Enabled = true for _, Slot in next, Holder:GetChildren() do local Button = Slot:FindFirstChild("Button") local Banner = Button:FindFirstChild("Banner") local Price = Banner:FindFirstChild("Price") local Title = Button:FindFirstChild("Title") local Found, Amount = pcall(function() return SlotValues[tostring(Slot.Name)] end) if Found then Price.Text = string.format(PRICE_PREFIX, tostring(Amount)) local function updateBanner() local Credits = Player:FindFirstChild("Data"):FindFirstChild("Credits") Banner.BackgroundColor3 = BannerColors[Credits.Value >= Amount] end local TweenBannerIn = TweenService:Create(Banner, ButtonTweenInfo, { Position = UDim2.new(0, 0, 0.698, 0) }) local TweenBannerOut = TweenService:Create(Banner, ButtonTweenInfo, { Position = UDim2.new(0, 0, 1.298, 0) }) local TweenTitleIn = TweenService:Create(Title, ButtonTweenInfo, { Position = UDim2.new(0.5, 0, 0.3, 0) }) local TweenTitleOut = TweenService:Create(Title, ButtonTweenInfo, { Position = UDim2.new(0.5, 0, 0.5, 0) }) Button.MouseEnter:Connect(function() updateBanner() TweenBannerIn:Play() TweenTitleIn:Play() end) Button.MouseLeave:Connect(function() TweenBannerOut:Play() TweenTitleOut:Play() end) local DB = false Button.MouseButton1Down:Connect(function() if DB == false then DB = true Click.TimePosition = 0.6 Click:Play() delay(1, function() DB = false end) local Credits = Player:WaitForChild("Data"):FindFirstChild("Credits") if Credits.Value <= Amount then BuyRemote:FireServer(Slot.Name) GhostIcon(Button.Parent) end end end) end end end function GhostIcon(Icon) local NewGhost = Ghost:Clone() local Scale = NewGhost:FindFirstChild("UIScale") NewGhost.Parent = Holder local TweenOutTrans = TweenService:Create(NewGhost, QuadTweenInfo, { BackgroundTransparency = 1 }) local TweenScale = TweenService:Create(Scale, QuadTweenInfo, { Scale = 1 }) NewGhost.Position = Icon.Position + GhostOffset NewGhost.BackgroundTransparency = 0.5 Scale.Scale = 0.5 TweenOutTrans:Play() TweenScale:Play() TweenOutTrans.Completed:Wait() NewGhost:Destroy() end function UIControl:Open() UtilModule:AddBlur(25) Main.Visible = true MainTweenIn:Play() end function UIControl:Close() UtilModule:RemoveBlur() MainTweenOut:Play() end return UIControl