Game script I made in 1 hour
Key RequiredUniversal

Game script I made in 1 hour

Universal ScriptDevexProjectSSDevexProjectSS 8.3K views 1.4K executesUpdated Nov 7, 2025
5.0/ 5(1 votes)
10100% Positive
Lua Script•299 lines (10104 chars)
local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")

local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "BakeryMiniGame"
ScreenGui.Parent = playerGui


local MainFrame = Instance.new("Frame")
MainFrame.Size = UDim2.new(0, 600, 0, 750)
MainFrame.Position = UDim2.new(0.5, -300, 0.5, -375)
MainFrame.BackgroundColor3 = Color3.fromRGB(245, 222, 179)
MainFrame.BorderSizePixel = 0
MainFrame.Parent = ScreenGui


local Title = Instance.new("TextLabel")
Title.Size = UDim2.new(1, 0, 0, 50)
Title.BackgroundTransparency = 1
Title.Text = "🍰 Bakery Mini Game"
Title.Font = Enum.Font.GothamBold
Title.TextSize = 26
Title.Parent = MainFrame


local ingredients = {"Flour", "Sugar", "Eggs", "Milk", "Cheese", "Tomato", "Dough", "Beef", "Lettuce", "Bread"}
local selectedIngredients = {}

local IngredientLabel = Instance.new("TextLabel")
IngredientLabel.Size = UDim2.new(1, 0, 0, 30)
IngredientLabel.Position = UDim2.new(0,0,0,60)
IngredientLabel.Text = "Selected Ingredients: None"
IngredientLabel.BackgroundTransparency = 1
IngredientLabel.Font = Enum.Font.Gotham
IngredientLabel.TextSize = 18
IngredientLabel.Parent = MainFrame

local ingredientButtons = {}
for i, ingredient in ipairs(ingredients) do
    local button = Instance.new("TextButton")
    button.Size = UDim2.new(0, 120, 0, 40)
    button.Position = UDim2.new(0, 10 + ((i-1)%4)*130, 0, 100 + math.floor((i-1)/4)*50)
    button.Text = ingredient
    button.Font = Enum.Font.Gotham
    button.TextSize = 16
    button.BackgroundColor3 = Color3.fromRGB(220, 180, 140)
    button.Parent = MainFrame

    button.MouseButton1Click:Connect(function()
        table.insert(selectedIngredients, ingredient)
        IngredientLabel.Text = "Selected Ingredients: " .. table.concat(selectedIngredients, ", ")
    end)

    ingredientButtons[ingredient] = button
end

-- Recipes Table That DcruzRace made--
local recipes = {
    Cookies = {"Flour", "Sugar", "Eggs"},
    Cake = {"Flour", "Sugar", "Eggs", "Milk"},
    Pizza = {"Dough", "Cheese", "Tomato"},
    Burger = {"Bread", "Beef", "Lettuce"}
}
local cookingTime = 10 -- Fixed 10 seconds per dish

-- Guide GUI Devex--
local GuideFrame = Instance.new("Frame")
GuideFrame.Size = UDim2.new(0, 300, 0, 250)
GuideFrame.Position = UDim2.new(0.5, -150, 0.5, -125)
GuideFrame.BackgroundColor3 = Color3.fromRGB(255, 250, 240)
GuideFrame.BorderSizePixel = 2
GuideFrame.Visible = false
GuideFrame.Parent = ScreenGui

local GuideTitle = Instance.new("TextLabel")
GuideTitle.Size = UDim2.new(1, 0, 0, 40)
GuideTitle.BackgroundTransparency = 1
GuideTitle.Text = "🍴 Recipe Guide"
GuideTitle.Font = Enum.Font.GothamBold
GuideTitle.TextSize = 22
GuideTitle.Parent = GuideFrame

local yOffset = 50
for recipe, ing in pairs(recipes) do
    local label = Instance.new("TextLabel")
    label.Size = UDim2.new(1, -20, 0, 30)
    label.Position = UDim2.new(0, 10, 0, yOffset)
    label.BackgroundTransparency = 1
    label.Text = recipe .. " = " .. table.concat(ing, ", ")
    label.Font = Enum.Font.Gotham
    label.TextSize = 16
    label.TextXAlignment = Enum.TextXAlignment.Left
    label.Parent = GuideFrame
    yOffset = yOffset + 35
end

local GuideButton = Instance.new("TextButton")
GuideButton.Size = UDim2.new(0, 150, 0, 40)
GuideButton.Position = UDim2.new(0.5, -75, 0, 400)
GuideButton.Text = "Show Recipe Guide 📖"
GuideButton.Font = Enum.Font.Gotham
GuideButton.TextSize = 18
GuideButton.BackgroundColor3 = Color3.fromRGB(150, 200, 255)
GuideButton.Parent = MainFrame

GuideButton.MouseButton1Click:Connect(function()
    GuideFrame.Visible = not GuideFrame.Visible
end)


local customers = {"Customer1", "Customer2", "Customer3"}
local customerOrders = {}
local customerTimers = {}
local customerBlocks = {}
local servedCount = 0
local totalCustomers = 0
local maxCustomers = 36

local CustomerLabelFrame = Instance.new("Frame")
CustomerLabelFrame.Size = UDim2.new(1, 0, 0, 400)
CustomerLabelFrame.Position = UDim2.new(0, 0, 0, 460)
CustomerLabelFrame.BackgroundTransparency = 1
CustomerLabelFrame.Parent = MainFrame

local colors = {Color3.fromRGB(255,100,100), Color3.fromRGB(100,255,100), Color3.fromRGB(100,100,255)}

local function spawnCustomer()
    if totalCustomers >= maxCustomers then return end
    totalCustomers = totalCustomers + 1
    local customer = customers[math.random(1,#customers)]
    local recipeNames = {}
    for r,_ in pairs(recipes) do table.insert(recipeNames,r) end
    local order = recipeNames[math.random(1,#recipeNames)]
    customerOrders[customer] = order
    customerTimers[customer] = 20

    local block = Instance.new("Frame")
    block.Size = UDim2.new(0, 150, 0, 30)
    -- Arrange vertically to prevent overlapping
    block.Position = UDim2.new(0, 10, 0, (#CustomerLabelFrame:GetChildren())*35)
    block.BackgroundColor3 = colors[math.random(1,#colors)]
    block.BorderSizePixel = 2
    block.Parent = CustomerLabelFrame
    customerBlocks[customer] = block

    local text = Instance.new("TextLabel")
    text.Size = UDim2.new(1, 0, 1, 0)
    text.BackgroundTransparency = 1
    text.Text = customer .. " wants " .. order .. " | Time left: " .. customerTimers[customer] .. "s"
    text.Font = Enum.Font.Gotham
    text.TextSize = 16
    text.Parent = block

    spawn(function()
        while customerTimers[customer] > 0 do
            wait(1)
            customerTimers[customer] = customerTimers[customer] - 1
            if customerTimers[customer] > 0 then
                text.Text = customer .. " wants " .. order .. " | Time left: " .. customerTimers[customer] .. "s"
            end
        end
        if customerOrders[customer] then
            text.Text = customer .. " left! 😢"
            customerOrders[customer] = nil
            customerTimers[customer] = nil
            block:Destroy()
        end
    end)
end


local cookButton = Instance.new("TextButton")
cookButton.Size = UDim2.new(0, 150, 0, 50)
cookButton.Position = UDim2.new(0.5, -75, 0, 520)
cookButton.Text = "Cook Dish 🍳"
cookButton.Font = Enum.Font.Gotham
cookButton.TextSize = 18
cookButton.BackgroundColor3 = Color3.fromRGB(200, 100, 100)
cookButton.Parent = MainFrame

local cookingLabel = Instance.new("TextLabel")
cookingLabel.Size = UDim2.new(1,0,0,40)
cookingLabel.Position = UDim2.new(0,0,0,580)
cookingLabel.BackgroundTransparency = 1
cookingLabel.Font = Enum.Font.Gotham
cookingLabel.TextSize = 18
cookingLabel.Text = "Select ingredients to cook!"
cookingLabel.Parent = MainFrame

--DcruzRace did this part--
local progressBars = {}
for i = 1, 3 do
    local barBackground = Instance.new("Frame")
    barBackground.Size = UDim2.new(0, 400, 0, 20)
    barBackground.Position = UDim2.new(0.5, -200, 0, 620 + (i-1)*30)
    barBackground.BackgroundColor3 = Color3.fromRGB(200,200,200)
    barBackground.BorderSizePixel = 2
    barBackground.Parent = MainFrame

    local barFill = Instance.new("Frame")
    barFill.Size = UDim2.new(0, 0, 1, 0)
    barFill.BackgroundColor3 = Color3.fromRGB(100,200,100)
    barFill.BorderSizePixel = 0
    barFill.Parent = barBackground

    table.insert(progressBars, barFill)
end

--Devex takes over here--
local restartButton = Instance.new("TextButton")
restartButton.Size = UDim2.new(0, 200, 0, 50)
restartButton.Position = UDim2.new(0.5, -100, 0.5, 0)
restartButton.Text = "Restart Game 🔄"
restartButton.Font = Enum.Font.GothamBold
restartButton.TextSize = 22
restartButton.BackgroundColor3 = Color3.fromRGB(255,150,100)
restartButton.Visible = false
restartButton.Parent = MainFrame

restartButton.MouseButton1Click:Connect(function()
    ScreenGui:Destroy()
end)


cookButton.MouseButton1Click:Connect(function()
    local tempIngredients = {table.unpack(selectedIngredients)}
    selectedIngredients = {}
    IngredientLabel.Text = "Selected Ingredients: None"

    local dishesToCook = {}
    for _ = 1, 3 do
        local madeDish = nil
        for recipe, reqIngredients in pairs(recipes) do
            local match = true
            for _, req in ipairs(reqIngredients) do
                if not table.find(tempIngredients, req) then
                    match = false
                    break
                end
            end
            if match and #reqIngredients == #tempIngredients then
                madeDish = recipe
                break
            end
        end
        if madeDish then
            table.insert(dishesToCook, madeDish)
            tempIngredients = {}
        end
    end

    for i, dish in ipairs(dishesToCook) do
        spawn(function()
            local elapsed = 0
            progressBars[i].Size = UDim2.new(0,0,1,0)
            while elapsed < cookingTime do
                wait(0.1)
                elapsed = elapsed + 0.1
                progressBars[i].Size = UDim2.new(math.clamp(elapsed/cookingTime,0,1),0,1,0)
            end
            cookingLabel.Text = dish .. " is ready! 🍽️"

            for customer, order in pairs(customerOrders) do
                if order == dish then
                    cookingLabel.Text = customer .. " got their " .. dish .. "! 😃"
                    customerOrders[customer] = nil
                    customerTimers[customer] = nil
                    if customerBlocks[customer] then
                        customerBlocks[customer]:Destroy()
                    end
                    servedCount = servedCount + 1
                    break
                end
            end

            wait(0.5)
            progressBars[i].Size = UDim2.new(0,0,1,0)
            cookingLabel.Text = "Select ingredients to cook!"

            
            if totalCustomers >= maxCustomers and #customerOrders == 0 then
                if servedCount >= 33 then
                    cookingLabel.Text = "🎉 You Win! Served " .. servedCount .. " customers!"
                else
                    cookingLabel.Text = "😢 You Lose! Only served " .. servedCount .. " customers."
                end
                restartButton.Visible = true
            end
        end)
    end
end)


spawn(function()
    while totalCustomers < maxCustomers do
        spawnCustomer()
        wait(20)
    end
end)

Features & Information

I was challenged by my Cousin to make a Game script in 1 hour with zero play tests If i will not be Updating this btw because It was a challenge chill Credits: DcruzRace: Made the Bet and helped with some parts Devex: Made the UI and the baking Scripts and the AI for the Costumers
#Devex#Cooking#hourscript#Im stealing ur car keys#HAHAHAH

Community Comments (8)

DevexProjectSSDevexProjectSSNov 7, 2025

I will not be Updating this Thank you DcruzRace for the idea and for helping:)

Replying to @DevexProjectSS
DevexProjectSSDevexProjectSSNov 7, 2025

I tested it after I published it and I think it's pretty good for no testing I've been creating GUIs alot and 2D games so for no testing it's good they're is glitches but I'm not updating ts

Blue_PikminBlue_PikminNov 7, 2025

Nice ChatGPT script

Replying to @Blue_Pikmin
DevexProjectSSDevexProjectSSNov 7, 2025

@Blue_Pikmin hell you mean I made it with my own two hands

czchizczchizNov 7, 2025

spawn and wait is deprecated for the task.* functions, please use them instead

Replying to @czchiz
DevexProjectSSDevexProjectSSNov 7, 2025

@czchiz I said I'm not updating Ts

irisesirisesNov 7, 2025

1 hour to ask chatgpt because it kept denying

Replying to @irises
DevexProjectSSDevexProjectSSNov 7, 2025

@HeroX -_-

More Scripts for Universal Scripts