Whithout UI code OpenSource
Key Required

Whithout UI code OpenSource

Spin a Baddie 🎲REDzREDz 1.5K views 280 executesUpdated Feb 27, 2026
3.8/ 5(4 votes)
3175% Positive
Lua Script•282 lines (8155 chars)
local SETTINGS = {
	-- Roll
	["AUTO_ROLL"] = true, -- auto roll (false|true)
	
	-- Stock
	["AUTO_DICE_STOCK"] = true, -- auto purchase dice stock (false|true)
	["AUTO_POTION_STOCK"] = true, -- auto purchase potions stock (false|true)
	["AUTO_MERCHANT_STOCK"] = true, -- auto purchase merchant stock when arrive (false|true)
	
	-- Roulette
	["AUTO_ROLL_ROULETTE"] = true, -- auto spin roulette (false|true)
	
	-- Quests
	["AUTO_CLAIM_QUESTS"] = true, -- auto claim quests rewards (false|true)
	
	-- Baddies
	["AUTO_EQUIP_BEST_BADDIES"] = true, -- auto equip/place best baddies (false|true)
	["BEST_BADDIES_EQUIP_COOLDOWN"] = 180, -- cooldown to equip/place best baddies (number in seconds)
}

if not game.IsLoaded then game.Laoded:Wait() end

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local GameStatus = ReplicatedStorage.status

local MerchantBuyRemote = ReplicatedStorage.Events.MerchantBuy
local MerchantRequestRemote = ReplicatedStorage.Events.MerchantRequest
local MerchantStockUpdateRemote = ReplicatedStorage.Events.MerchantStockUpdate
local UpdateRollingDiceRemote = ReplicatedStorage.Events.updateRollingDice
local PlaceBestBaddiesRemote = ReplicatedStorage.Events.PlaceBestBaddies
local SponRequestRemote = ReplicatedStorage.Events.spinrequest
local RegularPetRemote = ReplicatedStorage.Events.RegularPet
local QuestRemote = ReplicatedStorage.Events.QuestRemote
local BuyItemRemote = ReplicatedStorage.Events.buy

local Player = Players.LocalPlayer
local GameEnv = getsenv(Player.PlayerScripts:FindFirstChildOfClass("LocalScript"))._G

while not (GameEnv.Profile and GameEnv.Profile.Data) do
	task.wait()
end

local PotionsData = require(ReplicatedStorage.Modules.PotionData)
local DicesData = require(ReplicatedStorage.Modules.DiceData)

local BEST_BADDIES_EQUIP_COOLDOWN = SETTINGS["BEST_BADDIES_EQUIP_COOLDOWN"]
local EQUIP_BEST_COOLDOWN = 0

local Connections = {}
local MerchantStock = nil

local NULITTY_SPAWN_CFRAME = CFrame.new(-58, 8, -19)

if type(BEST_BADDIES_EQUIP_COOLDOWN) ~= "number" then
	BEST_BADDIES_EQUIP_COOLDOWN = 30
end

local function IsAlive(Character)
	local Humanoid = Character and Character:FindFirstChildOfClass("Humanoid")
	return Humanoid and Humanoid.Health > 0
end

local function GetCharacter(Target)
	local Character = (Target or Player).Character
	return IsAlive(Character) and Character
end

local function GetRootPart(Target)
	local Character = GetCharacter(Target)
	return Character and Character:FindFirstChild("HumanoidRootPart")
end

local function GetCoins()
	return GameEnv.Profile.Data.Coins or 0
end

local function GetRebirths()
	return GameEnv.Profile.Data.Rebirths or 0
end

local function GetSpins()
	return Player.rewards.SpinCount.Value
end

local function GetDiceStock()
	return GameEnv.Profile.Data.dice_stock
end

local function GetPotionStock()
	return GameEnv.Profile.Data.potion_stock
end

local function GetQuests()
	return (GameEnv.Profile.Data.quests or {}).active_quests
end

local function IsNullityActive()
	return GameStatus:GetAttribute("nullity_active")
end

local function ValidateMerchantStock()
	return MerchantStock and MerchantStock.wares
end

local function RequestMerchantStock()
	local RootPart = GetRootPart()
	if not RootPart then return end
	
	RootPart.CFrame = NULITTY_SPAWN_CFRAME
	MerchantStock = MerchantRequestRemote:InvokeServer()
	
	if not ValidateMerchantStock() and workspace:FindFirstChild("Nullity") then
		local ProximityPrompt = workspace.Nullity:FindFirstChild("ProximityPrompt", true)
		
		if ProximityPrompt then
			fireproximityprompt(ProximityPrompt)
			task.wait(2)
		end
	end
	
	return MerchantStock
end

--[[
table.foreach(getsenv(game.Players.LocalPlayer.PlayerScripts:FindFirstChildOfClass("LocalScript"))._G.Profile.Data, print)

setclipboard(game.HttpService:JSONEncode(getsenv(game.Players.LocalPlayer.PlayerScripts:FindFirstChildOfClass("LocalScript"))._G.Profile.Data.quests))
]]

local function RollNextDice()
	local RollState = Player.PlayerGui.Main:FindFirstChild("RollState", true)
	if not RollState then return end
	
	RollState:InvokeServer()
end

local function OpenEgg(EggName, Amount)
	task.spawn(RegularPetRemote.InvokeServer, RegularPetRemote, EggName or "CatEgg", Amount)
end

local function CheckCanPurchase(Data)
	if not Data.Not_Restockable then
		return (Data.Cost or 0) <= GetCoins() and (Data.RebirthsRequired or 0) <= GetRebirths()
	end
end

local function PurshaseItem(Category, ItemName, Data, StockAmount)
	local Affordability = math.floor(GetCoins() / Data.Cost)
	local MaxPurchase = math.min(StockAmount, Affordability)
	
	return BuyItemRemote:InvokeServer(ItemName, MaxPurchase, Category)
end

local function HandleConnections()
	local Connections = BADDIES_SCRIPT_CONNECTIONS or {}
	getgenv().BADDIES_SCRIPT_CONNECTIONS = Connections
	
	for index = #Connections, 1, -1 do
		Connections[index]:Disconnect()
		Connections[index] = nil
	end
	
	local function NewConnection(Signal, Func)
		table.insert(Connections, Signal:Connect(Func))
	end
	
	NewConnection(MerchantStockUpdateRemote.OnClientEvent, function(ID, Stock)
		while not ValidateMerchantStock() and IsNullityActive() do
			RequestMerchantStock()
		end
		
		MerchantStock.wares[ID].Stock = Stock
	end)
	
	NewConnection(GameStatus:GetAttributeChangedSignal("nullity_active"), function()
		if not IsNullityActive() then
			MerchantStock = nil
		end
	end)
end

local function PurchaseDiceStock()
	local DiceStock = GetDiceStock()
	if not DiceStock or not next(DiceStock) then return end
	
	for DiceName, DiceData in DicesData do
		local StockAmount = DiceStock[DiceName] or 0
		
		if StockAmount == 0 then continue end
		if not CheckCanPurchase(DiceData) then continue end
		
		-- { Cost: number, RebirthsRequired: number }
		if PurshaseItem("dice", DiceName, DiceData, StockAmount) then
			DiceStock[DiceName] = 0
		end
	end
end

local function PurchasePotionStock()
	local PotionStock = GetPotionStock()
	if not PotionStock or not next(PotionStock) then return end
	
	for PotionName, PotionData in PotionsData do
		local StockAmount = PotionStock[PotionName] or 0
		
		if StockAmount == 0 then continue end
		if not CheckCanPurchase(PotionData) then continue end
		
		-- { Cost: number, RebirthsRequired: number }
		if PurshaseItem("potion", PotionName, PotionData, StockAmount) then
			PotionStock[PotionName] = 0
		end
	end
end

local function RollRoulette()
	if GetSpins() > 0 then
		SponRequestRemote:InvokeServer()
	end
end

local function ClaimQuests()
	local ActiveQuests = GetQuests()
	if not ActiveQuests then return end
	
	for ID, Quest in ActiveQuests do
		if Quest.completed and not Quest.claimed then
			QuestRemote:InvokeServer("ClaimReward", ID)
		end
	end
end

local function EquipBestBaddies()
	if (tick() - EQUIP_BEST_COOLDOWN) > 0 then
		PlaceBestBaddiesRemote:InvokeServer()
		EQUIP_BEST_COOLDOWN = tick() + BEST_BADDIES_EQUIP_COOLDOWN
	end
end

local function PurchaseMerchantStock()
	while not ValidateMerchantStock() and IsNullityActive() do
		RequestMerchantStock()
	end
	
	if not IsNullityActive() then return end
	if not ValidateMerchantStock() then return end
	
	for ID, StockData in MerchantStock.wares do
		local DiceName = StockData.Name
		if not CheckCanPurchase(DicesData[DiceName]) then continue end
		
		for index = StockData.Stock, 1, -1 do
			if index == 1 then
				MerchantBuyRemote:InvokeServer(ID)
			else
				task.spawn(MerchantBuyRemote.InvokeServer, MerchantBuyRemote, ID)
			end
		end
	end
end

local function Main()
	local uid = math.random()
	shared.auid = uid
	
	HandleConnections()
	
	while task.wait() and shared.auid == uid do
		-- if SETTINGS["AUTO_EQUIP_BEST_DICE"] then EquipBestDice() end
		if SETTINGS["AUTO_ROLL"] then RollNextDice() end
		if SETTINGS["AUTO_DICE_STOCK"] then PurchaseDiceStock() end
		if SETTINGS["AUTO_POTION_STOCK"] then PurchasePotionStock() end
		if SETTINGS["AUTO_MERCHANT_STOCK"] then PurchaseMerchantStock() end
		if SETTINGS["AUTO_ROLL_ROULETTE"] then RollRoulette() end
		if SETTINGS["AUTO_CLAIM_QUESTS"] then ClaimQuests() end
		if SETTINGS["AUTO_EQUIP_BEST_BADDIES"] then EquipBestBaddies() end
	end
end

Main()

Features & Information

Auto Stock (Potions, Dice, Merchant) Auto Roll Next Dice Auto Roll Roulette Auto Place Best Baddies Auto Claim Quest Rewards

Community Comments (0)

No comments yet for this script.

More Scripts for Spin a Baddie 🎲