local player = game.Players.LocalPlayer local gui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui")) -- Frame local frame = Instance.new("Frame") frame.Size = UDim2.new(0, 220, 0, 180) frame.Position = UDim2.new(0.4, 0, 0.4, 0) frame.BackgroundColor3 = Color3.fromRGB(35, 35, 35) frame.Active = true frame.Draggable = true frame.Parent = gui -- Result text local resultText = Instance.new("TextLabel") resultText.Size = UDim2.new(1, 0, 0, 40) resultText.Position = UDim2.new(0, 0, 0, 5) resultText.BackgroundTransparency = 1 resultText.TextColor3 = Color3.fromRGB(255, 255, 255) resultText.Font = Enum.Font.GothamBold resultText.TextSize = 20 resultText.Text = "Click to Roll!" resultText.Parent = frame -- ImageButton (Your button) local rollButton = Instance.new("ImageButton") rollButton.Size = UDim2.new(1, -20, 0, 100) rollButton.Position = UDim2.new(0, 10, 0, 60) rollButton.BackgroundColor3 = Color3.fromRGB(50, 50, 50) rollButton.Image = "rbxassetid://139251498031820" -- button default image rollButton.Parent = frame -- Outcomes with images local outcomes = { {name = "la secret", chance = 0.5, image = "rbxassetid://129839581448511"}, {name = "spaghetti?", chance = 1, image = "rbxassetid://81523168377312"}, {name = "esok", chance = 5, image = "rbxassetid://94651310699569"}, {name = "hotspot", chance = 19, image = "rbxassetid://95860114543360"}, {name = "tortugini", chance = 74.5, image = "rbxassetid://81773691985224"}, } -- Roll function (0 to 100 exact) local function roll() local r = math.random() * 100 local cumulative = 0 for _, item in ipairs(outcomes) do cumulative = cumulative + item.chance if r <= cumulative then return item end end end -- On click rollButton.MouseButton1Click:Connect(function() local result = roll() -- Update text + image resultText.Text = "You got: " .. result.name rollButton.Image = result.image end)