game inside game  BETA
Key RequiredUniversal

game inside game BETA

Universal ScriptEnergyBloxEnergyBlox 18.4K views 33 executesUpdated Feb 9, 2025
5.0/ 5(2 votes)
20100% Positive
Lua Script•119 lines (3911 chars)
--// 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

--// GUI Setup
local screenGui = Instance.new("ScreenGui", playerGui)
local frame = Instance.new("Frame", screenGui)
frame.Size = UDim2.new(1, 0, 1, 0)
frame.BackgroundColor3 = Color3.new(0, 0, 0.5)

local rollButton = Instance.new("TextButton", frame)
rollButton.Size = UDim2.new(0.3, 0, 0.1, 0)
rollButton.Position = UDim2.new(0.35, 0, 0.4, 0)
rollButton.Text = "Roll!"

local resultLabel = Instance.new("TextLabel", frame)
resultLabel.Size = UDim2.new(0.4, 0, 0.1, 0)
resultLabel.Position = UDim2.new(0.3, 0, 0.55, 0)
resultLabel.Text = ""
resultLabel.TextColor3 = Color3.new(1, 1, 1)
resultLabel.BackgroundTransparency = 1
resultLabel.TextScaled = true

local closeButton = Instance.new("TextButton", frame)
closeButton.Size = UDim2.new(0.1, 0, 0.05, 0)
closeButton.Position = UDim2.new(0.9, 0, 0, 0)
closeButton.Text = "Close"
closeButton.MouseButton1Click:Connect(function()
    screenGui:Destroy()
end)

--// Shop GUI
local shopFrame = Instance.new("Frame", screenGui)
shopFrame.Size = UDim2.new(0.3, 0, 1, 0)
shopFrame.Position = UDim2.new(0.7, 0, 0, 0)
shopFrame.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)

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.TextScaled = true

local shopCloseButton = Instance.new("TextButton", shopFrame)
shopCloseButton.Size = UDim2.new(0.3, 0, 0.1, 0)
shopCloseButton.Position = UDim2.new(0.35, 0, 0.9, 0)
shopCloseButton.Text = "Close Shop"
shopCloseButton.TextColor3 = Color3.new(1, 1, 1)
shopCloseButton.BackgroundColor3 = Color3.new(0.5, 0, 0.5)
shopCloseButton.MouseButton1Click:Connect(function()
    shopFrame.Visible = false
end)

--// Rarity System (Randomized Chances)
local rarities = {
    {name = "Common", reward = 10},
    {name = "Uncommon", reward = 15},
    {name = "Rare", reward = 20},
    {name = "Ultra Rare", reward = 25}
}

local canRoll = true
local function rollRarity()
    if not canRoll then return end
    canRoll = false
    task.wait(3) -- Cooldown of 3 seconds
    local roll = math.random()
    local selectedRarity = rarities[1]
    if roll < 0.05 then
        selectedRarity = rarities[4] -- Ultra Rare
    elseif roll < 0.2 then
        selectedRarity = rarities[3] -- Rare
    elseif roll < 0.5 then
        selectedRarity = rarities[2] -- Uncommon
    end
    coins.Value = coins.Value + selectedRarity.reward
    resultLabel.Text = "You rolled: " .. selectedRarity.name .. "! Coins: " .. coins.Value
    print("You rolled: " .. selectedRarity.name .. "! Coins: " .. coins.Value)
    canRoll = true
end

rollButton.MouseButton1Click:Connect(rollRarity)

--// Badge Shop
local badgeCosts = {
    ["Beginner Badge"] = 50,
    ["Adventurer Badge"] = 100,
    ["Pro Badge"] = 150,
    ["Hacker Badge"] = 200,
    ["BRO IS SIGMA"] = 250
}

local function buyBadge(badgeName)
    if coins.Value >= badgeCosts[badgeName] then
        coins.Value = coins.Value - badgeCosts[badgeName]
        print("You bought: " .. badgeName)
        if badgeName == "BRO IS SIGMA" then
            print("wow bro played game in game real")
        end
    else
        print("Not enough coins!")
    end
end

-- Creating shop buttons
for badgeName, cost in pairs(badgeCosts) do
    local badgeButton = Instance.new("TextButton", shopFrame)
    badgeButton.Size = UDim2.new(1, 0, 0.1, 0)
    badgeButton.Text = badgeName .. " - " .. cost .. " Coins"
    badgeButton.TextColor3 = Color3.new(1, 1, 1)
    badgeButton.BackgroundColor3 = Color3.new(0.3, 0.3, 0.3)
    badgeButton.MouseButton1Click:Connect(function()
        buyBadge(badgeName)
    end)
end

Features & Information

a game insidea game incase your bored autofarming in whatever game its like sols rng but with badges more stuff wil be added in the future!

Community Comments (3)

Aceii_Aceii_Feb 9, 2025(edited)

i could make something like this and give it to u but better.

EnergyBloxEnergyBloxFeb 9, 2025(edited)

@shadowdevnothere yeah can you make it function better to? i used chatgpt for the buying system and coded the rolling only lol

Aceii_Aceii_Feb 10, 2025(edited)

@scriptiux_inc i can do that indeed but not rn.

More Scripts for Universal Scripts