Double Or Nothing Script For Fun
Key Required

Double Or Nothing Script For Fun

[W4] Ride a Box Obby 📦Yosef_1220Yosef_1220 646 views 132 executesUpdated Apr 12, 2026
3.3/ 5(3 votes)
2167% Positive
Lua Script•444 lines (15750 chars)
local player = game:GetService("Players").LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")

local winSound = Instance.new("Sound")
winSound.SoundId = "rbxassetid://132919665409307"
winSound.Volume = 0.8
winSound.Parent = game:GetService("SoundService")

local loseSound = Instance.new("Sound")
loseSound.SoundId = "rbxassetid://125623877509633"
loseSound.Volume = 0.8
loseSound.Parent = game:GetService("SoundService")

local function saveSettings(index, bet, buffEndTime, isMuted)
    if writefile then
        pcall(function()
            writefile("DoubleOrNothing_AdvSettings.txt", tostring(index) .. "," .. tostring(bet) .. "," .. tostring(buffEndTime) .. "," .. tostring(isMuted))
        end)
    end
end

local baseWinChance = 50
local winChance = 50
local activeBuffPercent = 0

local function loadSettings()
    if readfile then
        local success, result = pcall(function()
            return readfile("DoubleOrNothing_AdvSettings.txt")
        end)
        if success and result then
            local data = string.split(result, ",")
            local index = tonumber(data[1])
            local bet = data[2] or ""
            local buffEndTime = tonumber(data[3]) or 0
            local isMuted = data[4] == "true"
            
            local currentTime = os.time()
            if currentTime < buffEndTime then
                local timeLeft = buffEndTime - currentTime
                if timeLeft > (35 * 60) then
                    winChance = 98
                    activeBuffPercent = 98
                else
                    winChance = 80
                    activeBuffPercent = 80
                end
            end
            
            if index and index >= 1 and index <= 4 then
                return index, bet, buffEndTime, isMuted
            end
        end
    end
    return 1, "", 0, false
end

local currentCurrencyIndex, savedBet, savedBuffEndTime, isMuted = loadSettings()

winSound.Volume = isMuted and 0 or 0.8
loseSound.Volume = isMuted and 0 or 0.8

if playerGui:FindFirstChild("DoubleOrNothingGui") then
    playerGui.DoubleOrNothingGui:Destroy()
end

local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "DoubleOrNothingGui"
ScreenGui.Parent = playerGui
ScreenGui.ResetOnSpawn = false

local MainFrame = Instance.new("Frame")
MainFrame.Name = "MainFrame"
MainFrame.Parent = ScreenGui
MainFrame.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
MainFrame.Position = UDim2.new(0.5, -125, 0.5, -220)
MainFrame.Size = UDim2.new(0, 250, 0, 440)
MainFrame.BorderSizePixel = 2
MainFrame.BorderColor3 = Color3.fromRGB(255, 255, 255)
MainFrame.Active = true
MainFrame.Draggable = true

local Title = Instance.new("TextLabel")
Title.Name = "Title"
Title.Parent = MainFrame
Title.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
Title.BorderSizePixel = 0
Title.Size = UDim2.new(1, 0, 0, 35)
Title.Font = Enum.Font.SourceSansBold
Title.Text = "Double or Nothing"
Title.TextColor3 = Color3.fromRGB(255, 255, 255)
Title.TextSize = 18

local TimerLabel = Instance.new("TextLabel")
TimerLabel.Name = "TimerLabel"
TimerLabel.Parent = MainFrame
TimerLabel.BackgroundTransparency = 1
TimerLabel.Position = UDim2.new(0.05, 0, 0.09, 0)
TimerLabel.Size = UDim2.new(0.9, 0, 0, 20)
TimerLabel.Font = Enum.Font.SourceSansBold
TimerLabel.Text = "Loading timer..."
TimerLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
TimerLabel.TextSize = 14

local BuffLabel = Instance.new("TextLabel")
BuffLabel.Name = "BuffLabel"
BuffLabel.Parent = MainFrame
BuffLabel.BackgroundTransparency = 1
BuffLabel.Position = UDim2.new(0.05, 0, 0.14, 0)
BuffLabel.Size = UDim2.new(0.9, 0, 0, 20)
BuffLabel.Font = Enum.Font.SourceSansBold
BuffLabel.Text = "Buff: Inactive"
BuffLabel.TextColor3 = Color3.fromRGB(170, 170, 170)
BuffLabel.TextSize = 14

local CurrencyButton = Instance.new("TextButton")
CurrencyButton.Name = "CurrencyButton"
CurrencyButton.Parent = MainFrame
CurrencyButton.BackgroundColor3 = Color3.fromRGB(100, 100, 100)
CurrencyButton.Position = UDim2.new(0.1, 0, 0.20, 0)
CurrencyButton.Size = UDim2.new(0.8, 0, 0, 25)
CurrencyButton.Font = Enum.Font.SourceSansBold
CurrencyButton.Text = "MODE: Coins"
CurrencyButton.TextColor3 = Color3.fromRGB(255, 255, 255)
CurrencyButton.TextSize = 15
CurrencyButton.BorderSizePixel = 1

local InputField = Instance.new("TextBox")
InputField.Name = "InputField"
InputField.Parent = MainFrame
InputField.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
InputField.Position = UDim2.new(0.1, 0, 0.28, 0)
InputField.Size = UDim2.new(0.8, 0, 0, 25)
InputField.Font = Enum.Font.SourceSans
InputField.PlaceholderText = "Type your bet here..."
InputField.Text = savedBet
InputField.TextColor3 = Color3.fromRGB(0, 0, 0)
InputField.PlaceholderColor3 = Color3.fromRGB(120, 120, 120)
InputField.TextSize = 15
InputField.ClearTextOnFocus = false

local GambleButton = Instance.new("TextButton")
GambleButton.Name = "GambleButton"
GambleButton.Parent = MainFrame
GambleButton.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
GambleButton.Position = UDim2.new(0.1, 0, 0.36, 0)
GambleButton.Size = UDim2.new(0.8, 0, 0, 25)
GambleButton.Font = Enum.Font.SourceSansBold
GambleButton.Text = "PLAY"
GambleButton.TextColor3 = Color3.fromRGB(255, 255, 255)
GambleButton.TextSize = 16
GambleButton.BorderSizePixel = 1

local AutoButton = Instance.new("TextButton")
AutoButton.Name = "AutoButton"
AutoButton.Parent = MainFrame
AutoButton.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
AutoButton.Position = UDim2.new(0.1, 0, 0.44, 0)
AutoButton.Size = UDim2.new(0.8, 0, 0, 25)
AutoButton.Font = Enum.Font.SourceSansBold
AutoButton.Text = "AUTO PLAY: OFF"
AutoButton.TextColor3 = Color3.fromRGB(255, 255, 255)
AutoButton.TextSize = 16
AutoButton.BorderSizePixel = 1

local Buy80BuffButton = Instance.new("TextButton")
Buy80BuffButton.Name = "Buy80BuffButton"
Buy80BuffButton.Parent = MainFrame
Buy80BuffButton.BackgroundColor3 = Color3.fromRGB(140, 0, 210)
Buy80BuffButton.Position = UDim2.new(0.1, 0, 0.52, 0)
Buy80BuffButton.Size = UDim2.new(0.8, 0, 0, 25)
Buy80BuffButton.Font = Enum.Font.SourceSansBold
Buy80BuffButton.Text = "Buy 80% Luck For 30 Mins (100k Coins)"
Buy80BuffButton.TextColor3 = Color3.fromRGB(255, 255, 255)
Buy80BuffButton.TextSize = 14
Buy80BuffButton.BorderSizePixel = 1

local Buy98BuffButton = Instance.new("TextButton")
Buy98BuffButton.Name = "Buy98BuffButton"
Buy98BuffButton.Parent = MainFrame
Buy98BuffButton.BackgroundColor3 = Color3.fromRGB(210, 140, 0)
Buy98BuffButton.Position = UDim2.new(0.1, 0, 0.60, 0)
Buy98BuffButton.Size = UDim2.new(0.8, 0, 0, 25)
Buy98BuffButton.Font = Enum.Font.SourceSansBold
Buy98BuffButton.Text = "Buy 98% Luck For 1 Day (50M Coins)"
Buy98BuffButton.TextColor3 = Color3.fromRGB(255, 255, 255)
Buy98BuffButton.TextSize = 14
Buy98BuffButton.BorderSizePixel = 1

local MuteButton = Instance.new("TextButton")
MuteButton.Name = "MuteButton"
MuteButton.Parent = MainFrame
MuteButton.BackgroundColor3 = isMuted and Color3.fromRGB(150, 50, 50) or Color3.fromRGB(50, 150, 50)
MuteButton.Position = UDim2.new(0.1, 0, 0.68, 0)
MuteButton.Size = UDim2.new(0.8, 0, 0, 25)
MuteButton.Font = Enum.Font.SourceSansBold
MuteButton.Text = isMuted and "Sound: OFF" or "Sound: ON"
MuteButton.TextColor3 = Color3.fromRGB(255, 255, 255)
MuteButton.TextSize = 14
MuteButton.BorderSizePixel = 1

local StatusLabel = Instance.new("TextLabel")
StatusLabel.Name = "StatusLabel"
StatusLabel.Parent = MainFrame
StatusLabel.BackgroundTransparency = 1
StatusLabel.Position = UDim2.new(0.1, 0, 0.76, 0)
StatusLabel.Size = UDim2.new(0.8, 0, 0, 40)
StatusLabel.Font = Enum.Font.SourceSansBold
StatusLabel.Text = "Enter amount and press Play"
StatusLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
StatusLabel.TextSize = 14
StatusLabel.TextWrapped = true

local currencies = {
    {name = "Coins", folder = "leaderstats"},
    {name = "Wins", folder = "leaderstats"},
    {name = "Skips", folder = "otherValues"},
    {name = "Spins", folder = "otherValues"}
}
CurrencyButton.Text = "MODE: " .. currencies[currentCurrencyIndex].name

local isAutoPlaying = false
local onCooldown = false
local buffEndTime = savedBuffEndTime

local function getPlayerBalance(currencyOverride)
    local activeCurrency = currencyOverride or currencies[currentCurrencyIndex]
    local folder = player:FindFirstChild(activeCurrency.folder)
    if folder then
        local valueObj = folder:FindFirstChild(activeCurrency.name)
        if valueObj and (valueObj:IsA("IntValue") or valueObj:IsA("NumberValue")) then
            return valueObj.Value
        end
    end
    return nil
end

local function sendReward(amount, currencyOverride)
    local activeCurrency = currencyOverride or currencies[currentCurrencyIndex]
    local args = {
        {
            Folder = activeCurrency.folder,
            Name = activeCurrency.name,
            Amount = amount
        }
    }
    local remote = game:GetService("ReplicatedStorage"):WaitForChild("Remotes"):WaitForChild("PromptReward")
    remote:FireServer(unpack(args))
end

task.spawn(function()
    while true do
        baseWinChance = 50
        TimerLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
        local normalTime = 5 * 60
        while normalTime > 0 do
            local mins = math.floor(normalTime / 60)
            local secs = normalTime % 60
            TimerLabel.Text = string.format("Normal Mode (50/50): %02d:%02d", mins, secs)
            task.wait(1)
            normalTime = normalTime - 1
        end
        
        baseWinChance = 65
        TimerLabel.TextColor3 = Color3.fromRGB(255, 215, 0)
        local luckyTime = 2 * 60
        while luckyTime > 0 do
            local mins = math.floor(luckyTime / 60)
            local secs = luckyTime % 60
            TimerLabel.Text = string.format("✨ LUCKY MODE (65/35): %02d:%02d ✨", mins, secs)
            task.wait(1)
            luckyTime = luckyTime - 1
        end
    end
end)

task.spawn(function()
    while true do
        local currentTime = os.time()
        if currentTime < buffEndTime then
            local timeLeft = buffEndTime - currentTime
            local hours = math.floor(timeLeft / 3600)
            local mins = math.floor((timeLeft % 3600) / 60)
            local secs = timeLeft % 60
            
            if hours > 0 then
                BuffLabel.Text = string.format("💎 LUCK %d%%: %02d:%02d:%02d 💎", activeBuffPercent, hours, mins, secs)
            else
                BuffLabel.Text = string.format("💎 LUCK %d%%: %02d:%02d 💎", activeBuffPercent, mins, secs)
            end
            BuffLabel.TextColor3 = Color3.fromRGB(0, 255, 170)
        else
            winChance = baseWinChance
            activeBuffPercent = 0
            BuffLabel.Text = "Buff: Inactive"
            BuffLabel.TextColor3 = Color3.fromRGB(170, 170, 170)
        end
        task.wait(1)
    end
end)

local function playGamble()
    local amount = tonumber(InputField.Text)
    local activeCurrency = currencies[currentCurrencyIndex]
    
    if not amount or amount <= 0 then
        StatusLabel.Text = "Enter a valid number!"
        StatusLabel.TextColor3 = Color3.fromRGB(255, 50, 50)
        return false
    end
    
    local currentBalance = getPlayerBalance()
    if currentBalance and amount > currentBalance then
        StatusLabel.Text = "❌ Not enough " .. activeCurrency.name .. "!"
        StatusLabel.TextColor3 = Color3.fromRGB(255, 50, 50)
        isAutoPlaying = false
        AutoButton.Text = "AUTO PLAY: OFF"
        AutoButton.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
        return false
    end
    
    saveSettings(currentCurrencyIndex, InputField.Text, buffEndTime, isMuted)
    
    local roll = math.random(1, 100)
    local win = roll <= winChance
    
    if win then
        local reward = math.floor(amount * 2)
        sendReward(reward)
        StatusLabel.Text = "WIN! You got " .. reward .. " " .. activeCurrency.name .. "!"
        StatusLabel.TextColor3 = Color3.fromRGB(50, 255, 50)
        winSound:Play() 
    else
        local loss = -math.floor(amount * 2)
        sendReward(loss)
        StatusLabel.Text = "LOSE! You lost " .. (amount * 2) .. " " .. activeCurrency.name .. " (x2)."
        StatusLabel.TextColor3 = Color3.fromRGB(255, 50, 50)
        loseSound:Play() 
    end
    return true
end

CurrencyButton.MouseButton1Click:Connect(function()
    currentCurrencyIndex = currentCurrencyIndex + 1
    if currentCurrencyIndex > #currencies then currentCurrencyIndex = 1 end
    CurrencyButton.Text = "MODE: " .. currencies[currentCurrencyIndex].name
    saveSettings(currentCurrencyIndex, InputField.Text, buffEndTime, isMuted)
end)

GambleButton.MouseButton1Click:Connect(function()
    if isAutoPlaying or onCooldown then return end 
    local success = playGamble()
    if success then
        onCooldown = true
        GambleButton.BackgroundColor3 = Color3.fromRGB(0, 100, 0)
        task.wait(0.2)
        GambleButton.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
        onCooldown = false
    end
end)

AutoButton.MouseButton1Click:Connect(function()
    isAutoPlaying = not isAutoPlaying
    if isAutoPlaying then
        AutoButton.Text = "AUTO PLAY: ON"
        AutoButton.BackgroundColor3 = Color3.fromRGB(0, 120, 200)
        task.spawn(function()
            while isAutoPlaying do
                local success = playGamble()
                if not success then break end
                task.wait(0.2)
            end
        end)
    else
        AutoButton.Text = "AUTO PLAY: OFF"
        AutoButton.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
    end
end)

Buy80BuffButton.MouseButton1Click:Connect(function()
    local coinsInfo = currencies[1]
    local currentCoins = getPlayerBalance(coinsInfo)
    
    if os.time() < buffEndTime then
        StatusLabel.Text = "❌ A buff is already active!"
        StatusLabel.TextColor3 = Color3.fromRGB(255, 50, 50)
        return
    end
    if not currentCoins or currentCoins < 100000 then
        StatusLabel.Text = "❌ Need 100k Coins!"
        StatusLabel.TextColor3 = Color3.fromRGB(255, 50, 50)
        return
    end
    
    sendReward(-100000, coinsInfo)
    buffEndTime = os.time() + (30 * 60)
    winChance = 80
    activeBuffPercent = 80
    saveSettings(currentCurrencyIndex, InputField.Text, buffEndTime, isMuted)
    
    StatusLabel.Text = "🎉 Bought 80% Luck for 30m!"
    StatusLabel.TextColor3 = Color3.fromRGB(0, 255, 170)
end)

Buy98BuffButton.MouseButton1Click:Connect(function()
    local coinsInfo = currencies[1]
    local currentCoins = getPlayerBalance(coinsInfo)
    
    if os.time() < buffEndTime then
        StatusLabel.Text = "❌ A buff is already active!"
        StatusLabel.TextColor3 = Color3.fromRGB(255, 50, 50)
        return
    end
    if not currentCoins or currentCoins < 50000000 then
        StatusLabel.Text = "❌ Need 50,000,000 Coins!"
        StatusLabel.TextColor3 = Color3.fromRGB(255, 50, 50)
        return
    end
    
    sendReward(-50000000, coinsInfo)
    buffEndTime = os.time() + (24 * 60 * 60)
    winChance = 98
    activeBuffPercent = 98
    saveSettings(currentCurrencyIndex, InputField.Text, buffEndTime, isMuted)
    
    StatusLabel.Text = "🎉 Bought 98% Luck for 1 day!"
    StatusLabel.TextColor3 = Color3.fromRGB(0, 255, 170)
end)

MuteButton.MouseButton1Click:Connect(function()
    isMuted = not isMuted
    if isMuted then
        winSound.Volume = 0
        loseSound.Volume = 0
        MuteButton.Text = "Sound: OFF"
        MuteButton.BackgroundColor3 = Color3.fromRGB(150, 50, 50)
    else
        winSound.Volume = 0.8
        loseSound.Volume = 0.8
        MuteButton.Text = "Sound: ON"
        MuteButton.BackgroundColor3 = Color3.fromRGB(50, 150, 50)
    end
    saveSettings(currentCurrencyIndex, InputField.Text, buffEndTime, isMuted)
end)

Features & Information

• Play Double or Nothing for Coins, Wins, Skips and Spins! • Type amount you want and click "Play" then you will see if you got x2 more or x2 less. • Every 5 mins you get 65% luck for 2 mins! • If you want to get more luck, you can buy with 100k coins 80% for 30 mins or 98% luck for 1 day! (Saves After Leaving) • Also you can click "Auto Play" if you wanna be afk or something! • there's a win and lose sound so if you wanna mute it just click "Sound: ON" and change it to "Sound: OFF". • This script made for fun... • check my other script! Enjoy! I think...
#RABO#Keyless#Gui#Ride a Box Obby#For Fun

Community Comments (0)

No comments yet for this script.

More Scripts for [W4] Ride a Box Obby 📦