Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ModuleScript в ReplicatedStorage (назовём "UTGGuiLibrary")
- local UTG = {}
- function UTG:CreateWindow(config)
- local player = game.Players.LocalPlayer
- local gui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))
- gui.Name = config.Name or "UTGWindow"
- gui.ResetOnSpawn = false
- local frame = Instance.new("Frame", gui)
- frame.Size = UDim2.new(0, 450, 0, 300)
- frame.Position = UDim2.new(0.5, -225, 0.5, -150)
- frame.BackgroundColor3 = Color3.fromRGB(10, 10, 10)
- frame.BackgroundTransparency = 0.2
- frame.AnchorPoint = Vector2.new(0.5, 0.5)
- local corner = Instance.new("UICorner", frame)
- corner.CornerRadius = UDim.new(0, 12)
- local stroke = Instance.new("UIStroke", frame)
- stroke.Color = config.Color or Color3.fromRGB(255, 0, 0)
- stroke.Thickness = 2
- local title = Instance.new("TextLabel", frame)
- title.Size = UDim2.new(1, 0, 0, 40)
- title.Text = config.Title or "UTG Custom GUI"
- title.TextColor3 = stroke.Color
- title.BackgroundTransparency = 1
- title.TextScaled = true
- title.Font = Enum.Font.Code
- -- Вернём объект с методами
- return {
- AddButton = function(self, text, callback)
- local button = Instance.new("TextButton", frame)
- button.Size = UDim2.new(0.8, 0, 0, 40)
- button.Position = UDim2.new(0.1, 0, 0, #frame:GetChildren() * 45)
- button.Text = text
- button.BackgroundColor3 = Color3.fromRGB(30, 0, 0)
- button.TextColor3 = stroke.Color
- button.TextScaled = true
- button.Font = Enum.Font.Code
- local btnCorner = Instance.new("UICorner", button)
- btnCorner.CornerRadius = UDim.new(0, 6)
- local btnStroke = Instance.new("UIStroke", button)
- btnStroke.Color = stroke.Color
- btnStroke.Transparency = 0.4
- btnStroke.Thickness = 1.5
- button.MouseButton1Click:Connect(callback)
- end
- }
- end
- return UTG
Advertisement
Add Comment
Please, Sign In to add comment