Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --// Variables
- local player = game.Players.LocalPlayer
- local playerGui = player:FindFirstChild("PlayerGui") or Instance.new("PlayerGui", player)
- local coins = Instance.new("IntValue", player)
- coins.Name = "Coins"
- coins.Value = 0
- --// Modern UI Theme
- local function createRoundedFrame(parent)
- local frame = Instance.new("Frame", parent)
- frame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- frame.BackgroundTransparency = 0.1
- frame.ClipsDescendants = true
- local uiCorner = Instance.new("UICorner", frame)
- uiCorner.CornerRadius = UDim.new(0, 12)
- local uiStroke = Instance.new("UIStroke", frame)
- uiStroke.Color = Color3.fromRGB(80, 80, 80)
- uiStroke.Thickness = 1
- return frame
- end
- --// Draggable UI Function
- local function makeDraggable(frame, handle)
- local dragging = false
- local dragInput, dragStart, startPos
- handle.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = true
- dragStart = input.Position
- startPos = frame.Position
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- dragging = false
- end
- end)
- end
- end)
- handle.InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement then
- dragInput = input
- end
- end)
- UserInputService.InputChanged:Connect(function(input)
- if input == dragInput and dragging then
- local delta = input.Position - dragStart
- frame.Position = UDim2.new(
- startPos.X.Scale,
- startPos.X.Offset + delta.X,
- startPos.Y.Scale,
- startPos.Y.Offset + delta.Y
- )
- end
- end)
- end
- --// Main GUI
- local screenGui = Instance.new("ScreenGui", playerGui)
- screenGui.Name = "MainGui"
- local mainFrame = createRoundedFrame(screenGui)
- mainFrame.Size = UDim2.new(0.35, 0, 0.45, 0)
- mainFrame.Position = UDim2.new(0.3, 0, 0.25, 0)
- local titleLabel = Instance.new("TextLabel", mainFrame)
- titleLabel.Size = UDim2.new(1, 0, 0.1, 0)
- titleLabel.Text = "🎰 Roll Simulator"
- titleLabel.TextColor3 = Color3.new(1, 1, 1)
- titleLabel.BackgroundTransparency = 1
- titleLabel.Font = Enum.Font.GothamSemibold
- titleLabel.TextSize = 18
- makeDraggable(mainFrame, titleLabel)
- -- Roll Button
- local rollButton = Instance.new("TextButton", mainFrame)
- rollButton.Size = UDim2.new(0.8, 0, 0.25, 0)
- rollButton.Position = UDim2.new(0.1, 0, 0.3, 0)
- rollButton.Text = "🔄 ROLL"
- rollButton.TextColor3 = Color3.new(1, 1, 1)
- rollButton.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
- rollButton.Font = Enum.Font.GothamBold
- rollButton.TextSize = 20
- local buttonCorner = Instance.new("UICorner", rollButton)
- buttonCorner.CornerRadius = UDim.new(0, 8)
- -- Result Display
- local resultFrame = createRoundedFrame(mainFrame)
- resultFrame.Size = UDim2.new(0.8, 0, 0.25, 0)
- resultFrame.Position = UDim2.new(0.1, 0, 0.6, 0)
- local resultLabel = Instance.new("TextLabel", resultFrame)
- resultLabel.Size = UDim2.new(1, 0, 1, 0)
- resultLabel.Text = "Click roll to start!"
- resultLabel.TextColor3 = Color3.new(1, 1, 1)
- resultLabel.BackgroundTransparency = 1
- resultLabel.Font = Enum.Font.Gotham
- resultLabel.TextSize = 16
- resultLabel.TextWrapped = true
- --// Shop GUI
- local shopFrame = createRoundedFrame(screenGui)
- shopFrame.Size = UDim2.new(0.3, 0, 0.6, 0)
- shopFrame.Position = UDim2.new(0.6, 0, 0.2, 0)
- shopFrame.Visible = false
- local shopTitle = Instance.new("TextLabel", shopFrame)
- shopTitle.Size = UDim2.new(1, 0, 0.1, 0)
- shopTitle.Text = "🛒 Badge Shop"
- shopTitle.TextColor3 = Color3.new(1, 1, 1)
- shopTitle.BackgroundTransparency = 1
- shopTitle.Font = Enum.Font.GothamSemibold
- shopTitle.TextSize = 18
- makeDraggable(shopFrame, shopTitle)
- --// Rarity System
- local rarities = {
- {name = "Common", reward = 10, color = Color3.fromRGB(200, 200, 200)},
- {name = "Uncommon", reward = 15, color = Color3.fromRGB(100, 200, 100)},
- {name = "Rare", reward = 20, color = Color3.fromRGB(100, 100, 200)},
- {name = "Epic", reward = 30, color = Color3.fromRGB(200, 100, 200)},
- {name = "Legendary", reward = 50, color = Color3.fromRGB(255, 215, 0)}
- }
- local function animateButton(button)
- button.Size = UDim2.new(0.78, 0, 0.23, 0)
- task.wait(0.1)
- button.Size = UDim2.new(0.8, 0, 0.25, 0)
- end
- local canRoll = true
- local function rollRarity()
- if not canRoll then return end
- canRoll = false
- animateButton(rollButton)
- -- Animate roll
- for i = 1, 5 do
- resultLabel.Text = "Rolling" .. string.rep(".", i % 4)
- task.wait(0.2)
- end
- local roll = math.random()
- local selectedRarity = rarities[1]
- if roll < 0.01 then
- selectedRarity = rarities[5]
- elseif roll < 0.05 then
- selectedRarity = rarities[4]
- elseif roll < 0.2 then
- selectedRarity = rarities[3]
- elseif roll < 0.5 then
- selectedRarity = rarities[2]
- end
- resultLabel.Text = string.format("🎉 %s Roll!\n+%d Coins", selectedRarity.name, selectedRarity.reward)
- resultLabel.TextColor3 = selectedRarity.color
- coins.Value += selectedRarity.reward
- canRoll = true
- end
- rollButton.MouseButton1Click:Connect(rollRarity)
- --// Toggle Shop
- local shopButton = Instance.new("TextButton", mainFrame)
- shopButton.Size = UDim2.new(0.35, 0, 0.1, 0)
- shopButton.Position = UDim2.new(0.1, 0, 0.15, 0)
- shopButton.Text = "🛍️ Shop"
- shopButton.TextColor3 = Color3.new(1, 1, 1)
- shopButton.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
- shopButton.Font = Enum.Font.Gotham
- shopButton.TextSize = 14
- Instance.new("UICorner", shopButton).CornerRadius = UDim.new(0, 6)
- shopButton.MouseButton1Click:Connect(function()
- shopFrame.Visible = not shopFrame.Visible
- end)
- --// Badge Shop Items
- local badgeShopItems = {
- {name = "Starter Pack", price = 100, emoji = "🎒"},
- {name = "Lucky Charm", price = 250, emoji = "🍀"},
- {name = "Golden Roll", price = 500, emoji = "🌟"},
- {name = "Mystery Box", price = 1000, emoji = "🎁"}
- }
- local function createShopItem(parent, index, item)
- local yPosition = 0.15 + (0.2 * (index - 1))
- local itemFrame = createRoundedFrame(parent)
- itemFrame.Size = UDim2.new(0.9, 0, 0.18, 0)
- itemFrame.Position = UDim2.new(0.05, 0, yPosition, 0)
- local emojiLabel = Instance.new("TextLabel", itemFrame)
- emojiLabel.Size = UDim2.new(0.2, 0, 1, 0)
- emojiLabel.Text = item.emoji
- emojiLabel.TextSize = 30
- emojiLabel.BackgroundTransparency = 1
- local infoFrame = Instance.new("Frame", itemFrame)
- infoFrame.Size = UDim2.new(0.7, 0, 1, 0)
- infoFrame.Position = UDim2.new(0.25, 0, 0, 0)
- infoFrame.BackgroundTransparency = 1
- local nameLabel = Instance.new("TextLabel", infoFrame)
- nameLabel.Size = UDim2.new(1, 0, 0.6, 0)
- nameLabel.Text = item.name
- nameLabel.TextColor3 = Color3.new(1, 1, 1)
- nameLabel.Font = Enum.Font.GothamSemibold
- nameLabel.TextSize = 16
- nameLabel.TextXAlignment = Enum.TextXAlignment.Left
- local priceLabel = Instance.new("TextLabel", infoFrame)
- priceLabel.Size = UDim2.new(1, 0, 0.4, 0)
- priceLabel.Position = UDim2.new(0, 0, 0.6, 0)
- priceLabel.Text = string.format("💰 %d Coins", item.price)
- priceLabel.TextColor3 = Color3.new(0.8, 0.8, 0.8)
- priceLabel.Font = Enum.Font.Gotham
- priceLabel.TextSize = 14
- priceLabel.TextXAlignment = Enum.TextXAlignment.Left
- local buyButton = Instance.new("TextButton", itemFrame)
- buyButton.Size = UDim2.new(0.25, 0, 0.6, 0)
- buyButton.Position = UDim2.new(0.7, 0, 0.2, 0)
- buyButton.Text = "Buy"
- buyButton.TextColor3 = Color3.new(1, 1, 1)
- buyButton.BackgroundColor3 = Color3.fromRGB(80, 160, 80)
- buyButton.Font = Enum.Font.GothamBold
- Instance.new("UICorner", buyButton).CornerRadius = UDim.new(0, 6)
- end
- -- Create shop items
- for i, item in ipairs(badgeShopItems) do
- createShopItem(shopFrame, i, item)
- end
- --// Close Buttons
- local function createCloseButton(parent)
- local closeButton = Instance.new("TextButton", parent)
- closeButton.Size = UDim2.new(0.08, 0, 0.08, 0)
- closeButton.Position = UDim2.new(0.9, 0, 0.02, 0)
- closeButton.Text = "×"
- closeButton.TextColor3 = Color3.new(1, 1, 1)
- closeButton.TextSize = 24
- closeButton.BackgroundTransparency = 1
- closeButton.MouseButton1Click:Connect(function()
- parent.Visible = false
- end)
- end
- createCloseButton(mainFrame)
- createCloseButton(shopFrame)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement