Advertisement
Djadjd

Script

Feb 9th, 2025 (edited)
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.66 KB | Source Code | 0 0
  1. --// Variables
  2. local player = game.Players.LocalPlayer
  3. local playerGui = player:FindFirstChild("PlayerGui") or Instance.new("PlayerGui", player)
  4. local coins = Instance.new("IntValue", player)
  5. coins.Name = "Coins"
  6. coins.Value = 0
  7.  
  8. --// Modern UI Theme
  9. local function createRoundedFrame(parent)
  10. local frame = Instance.new("Frame", parent)
  11. frame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  12. frame.BackgroundTransparency = 0.1
  13. frame.ClipsDescendants = true
  14.  
  15. local uiCorner = Instance.new("UICorner", frame)
  16. uiCorner.CornerRadius = UDim.new(0, 12)
  17.  
  18. local uiStroke = Instance.new("UIStroke", frame)
  19. uiStroke.Color = Color3.fromRGB(80, 80, 80)
  20. uiStroke.Thickness = 1
  21.  
  22. return frame
  23. end
  24.  
  25. --// Draggable UI Function
  26. local function makeDraggable(frame, handle)
  27. local dragging = false
  28. local dragInput, dragStart, startPos
  29.  
  30. handle.InputBegan:Connect(function(input)
  31. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  32. dragging = true
  33. dragStart = input.Position
  34. startPos = frame.Position
  35.  
  36. input.Changed:Connect(function()
  37. if input.UserInputState == Enum.UserInputState.End then
  38. dragging = false
  39. end
  40. end)
  41. end
  42. end)
  43.  
  44. handle.InputChanged:Connect(function(input)
  45. if input.UserInputType == Enum.UserInputType.MouseMovement then
  46. dragInput = input
  47. end
  48. end)
  49.  
  50. UserInputService.InputChanged:Connect(function(input)
  51. if input == dragInput and dragging then
  52. local delta = input.Position - dragStart
  53. frame.Position = UDim2.new(
  54. startPos.X.Scale,
  55. startPos.X.Offset + delta.X,
  56. startPos.Y.Scale,
  57. startPos.Y.Offset + delta.Y
  58. )
  59. end
  60. end)
  61. end
  62.  
  63. --// Main GUI
  64. local screenGui = Instance.new("ScreenGui", playerGui)
  65. screenGui.Name = "MainGui"
  66.  
  67. local mainFrame = createRoundedFrame(screenGui)
  68. mainFrame.Size = UDim2.new(0.35, 0, 0.45, 0)
  69. mainFrame.Position = UDim2.new(0.3, 0, 0.25, 0)
  70.  
  71. local titleLabel = Instance.new("TextLabel", mainFrame)
  72. titleLabel.Size = UDim2.new(1, 0, 0.1, 0)
  73. titleLabel.Text = "🎰 Roll Simulator"
  74. titleLabel.TextColor3 = Color3.new(1, 1, 1)
  75. titleLabel.BackgroundTransparency = 1
  76. titleLabel.Font = Enum.Font.GothamSemibold
  77. titleLabel.TextSize = 18
  78. makeDraggable(mainFrame, titleLabel)
  79.  
  80. -- Roll Button
  81. local rollButton = Instance.new("TextButton", mainFrame)
  82. rollButton.Size = UDim2.new(0.8, 0, 0.25, 0)
  83. rollButton.Position = UDim2.new(0.1, 0, 0.3, 0)
  84. rollButton.Text = "🔄 ROLL"
  85. rollButton.TextColor3 = Color3.new(1, 1, 1)
  86. rollButton.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
  87. rollButton.Font = Enum.Font.GothamBold
  88. rollButton.TextSize = 20
  89. local buttonCorner = Instance.new("UICorner", rollButton)
  90. buttonCorner.CornerRadius = UDim.new(0, 8)
  91.  
  92. -- Result Display
  93. local resultFrame = createRoundedFrame(mainFrame)
  94. resultFrame.Size = UDim2.new(0.8, 0, 0.25, 0)
  95. resultFrame.Position = UDim2.new(0.1, 0, 0.6, 0)
  96.  
  97. local resultLabel = Instance.new("TextLabel", resultFrame)
  98. resultLabel.Size = UDim2.new(1, 0, 1, 0)
  99. resultLabel.Text = "Click roll to start!"
  100. resultLabel.TextColor3 = Color3.new(1, 1, 1)
  101. resultLabel.BackgroundTransparency = 1
  102. resultLabel.Font = Enum.Font.Gotham
  103. resultLabel.TextSize = 16
  104. resultLabel.TextWrapped = true
  105.  
  106. --// Shop GUI
  107. local shopFrame = createRoundedFrame(screenGui)
  108. shopFrame.Size = UDim2.new(0.3, 0, 0.6, 0)
  109. shopFrame.Position = UDim2.new(0.6, 0, 0.2, 0)
  110. shopFrame.Visible = false
  111.  
  112. local shopTitle = Instance.new("TextLabel", shopFrame)
  113. shopTitle.Size = UDim2.new(1, 0, 0.1, 0)
  114. shopTitle.Text = "🛒 Badge Shop"
  115. shopTitle.TextColor3 = Color3.new(1, 1, 1)
  116. shopTitle.BackgroundTransparency = 1
  117. shopTitle.Font = Enum.Font.GothamSemibold
  118. shopTitle.TextSize = 18
  119. makeDraggable(shopFrame, shopTitle)
  120.  
  121. --// Rarity System
  122. local rarities = {
  123. {name = "Common", reward = 10, color = Color3.fromRGB(200, 200, 200)},
  124. {name = "Uncommon", reward = 15, color = Color3.fromRGB(100, 200, 100)},
  125. {name = "Rare", reward = 20, color = Color3.fromRGB(100, 100, 200)},
  126. {name = "Epic", reward = 30, color = Color3.fromRGB(200, 100, 200)},
  127. {name = "Legendary", reward = 50, color = Color3.fromRGB(255, 215, 0)}
  128. }
  129.  
  130. local function animateButton(button)
  131. button.Size = UDim2.new(0.78, 0, 0.23, 0)
  132. task.wait(0.1)
  133. button.Size = UDim2.new(0.8, 0, 0.25, 0)
  134. end
  135.  
  136. local canRoll = true
  137. local function rollRarity()
  138. if not canRoll then return end
  139. canRoll = false
  140. animateButton(rollButton)
  141.  
  142. -- Animate roll
  143. for i = 1, 5 do
  144. resultLabel.Text = "Rolling" .. string.rep(".", i % 4)
  145. task.wait(0.2)
  146. end
  147.  
  148. local roll = math.random()
  149. local selectedRarity = rarities[1]
  150. if roll < 0.01 then
  151. selectedRarity = rarities[5]
  152. elseif roll < 0.05 then
  153. selectedRarity = rarities[4]
  154. elseif roll < 0.2 then
  155. selectedRarity = rarities[3]
  156. elseif roll < 0.5 then
  157. selectedRarity = rarities[2]
  158. end
  159.  
  160. resultLabel.Text = string.format("🎉 %s Roll!\n+%d Coins", selectedRarity.name, selectedRarity.reward)
  161. resultLabel.TextColor3 = selectedRarity.color
  162. coins.Value += selectedRarity.reward
  163.  
  164. canRoll = true
  165. end
  166.  
  167. rollButton.MouseButton1Click:Connect(rollRarity)
  168.  
  169. --// Toggle Shop
  170. local shopButton = Instance.new("TextButton", mainFrame)
  171. shopButton.Size = UDim2.new(0.35, 0, 0.1, 0)
  172. shopButton.Position = UDim2.new(0.1, 0, 0.15, 0)
  173. shopButton.Text = "🛍️ Shop"
  174. shopButton.TextColor3 = Color3.new(1, 1, 1)
  175. shopButton.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
  176. shopButton.Font = Enum.Font.Gotham
  177. shopButton.TextSize = 14
  178. Instance.new("UICorner", shopButton).CornerRadius = UDim.new(0, 6)
  179.  
  180. shopButton.MouseButton1Click:Connect(function()
  181. shopFrame.Visible = not shopFrame.Visible
  182. end)
  183.  
  184. --// Badge Shop Items
  185. local badgeShopItems = {
  186. {name = "Starter Pack", price = 100, emoji = "🎒"},
  187. {name = "Lucky Charm", price = 250, emoji = "🍀"},
  188. {name = "Golden Roll", price = 500, emoji = "🌟"},
  189. {name = "Mystery Box", price = 1000, emoji = "🎁"}
  190. }
  191.  
  192. local function createShopItem(parent, index, item)
  193. local yPosition = 0.15 + (0.2 * (index - 1))
  194. local itemFrame = createRoundedFrame(parent)
  195. itemFrame.Size = UDim2.new(0.9, 0, 0.18, 0)
  196. itemFrame.Position = UDim2.new(0.05, 0, yPosition, 0)
  197.  
  198. local emojiLabel = Instance.new("TextLabel", itemFrame)
  199. emojiLabel.Size = UDim2.new(0.2, 0, 1, 0)
  200. emojiLabel.Text = item.emoji
  201. emojiLabel.TextSize = 30
  202. emojiLabel.BackgroundTransparency = 1
  203.  
  204. local infoFrame = Instance.new("Frame", itemFrame)
  205. infoFrame.Size = UDim2.new(0.7, 0, 1, 0)
  206. infoFrame.Position = UDim2.new(0.25, 0, 0, 0)
  207. infoFrame.BackgroundTransparency = 1
  208.  
  209. local nameLabel = Instance.new("TextLabel", infoFrame)
  210. nameLabel.Size = UDim2.new(1, 0, 0.6, 0)
  211. nameLabel.Text = item.name
  212. nameLabel.TextColor3 = Color3.new(1, 1, 1)
  213. nameLabel.Font = Enum.Font.GothamSemibold
  214. nameLabel.TextSize = 16
  215. nameLabel.TextXAlignment = Enum.TextXAlignment.Left
  216.  
  217. local priceLabel = Instance.new("TextLabel", infoFrame)
  218. priceLabel.Size = UDim2.new(1, 0, 0.4, 0)
  219. priceLabel.Position = UDim2.new(0, 0, 0.6, 0)
  220. priceLabel.Text = string.format("💰 %d Coins", item.price)
  221. priceLabel.TextColor3 = Color3.new(0.8, 0.8, 0.8)
  222. priceLabel.Font = Enum.Font.Gotham
  223. priceLabel.TextSize = 14
  224. priceLabel.TextXAlignment = Enum.TextXAlignment.Left
  225.  
  226. local buyButton = Instance.new("TextButton", itemFrame)
  227. buyButton.Size = UDim2.new(0.25, 0, 0.6, 0)
  228. buyButton.Position = UDim2.new(0.7, 0, 0.2, 0)
  229. buyButton.Text = "Buy"
  230. buyButton.TextColor3 = Color3.new(1, 1, 1)
  231. buyButton.BackgroundColor3 = Color3.fromRGB(80, 160, 80)
  232. buyButton.Font = Enum.Font.GothamBold
  233. Instance.new("UICorner", buyButton).CornerRadius = UDim.new(0, 6)
  234. end
  235.  
  236. -- Create shop items
  237. for i, item in ipairs(badgeShopItems) do
  238. createShopItem(shopFrame, i, item)
  239. end
  240.  
  241. --// Close Buttons
  242. local function createCloseButton(parent)
  243. local closeButton = Instance.new("TextButton", parent)
  244. closeButton.Size = UDim2.new(0.08, 0, 0.08, 0)
  245. closeButton.Position = UDim2.new(0.9, 0, 0.02, 0)
  246. closeButton.Text = "×"
  247. closeButton.TextColor3 = Color3.new(1, 1, 1)
  248. closeButton.TextSize = 24
  249. closeButton.BackgroundTransparency = 1
  250. closeButton.MouseButton1Click:Connect(function()
  251. parent.Visible = false
  252. end)
  253. end
  254.  
  255. createCloseButton(mainFrame)
  256. createCloseButton(shopFrame)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement