BBobloScript
AccountLog in or create an account to publish scripts.
Log inCreate account

Browse

ScriptsPlacesPopular ScriptsUsers

Script types

Universal scriptsKeyless scriptsKey system scriptsOpen source scripts

Tools

Submit Script

Community

DiscordTelegram
BBobloScript
Log in
BBobloScript

Free Roblox scripts, script hub, and Roblox game tools for the community.

Free Roblox scripts and game tools.

Roblox is a trademark of Roblox Corporation. This website is not affiliated with Roblox Corporation.Roblox is a trademark of Roblox Corporation. BobloScript is not affiliated with Roblox.

© 2026 BobloScript. All rights reserved.

Legal

Terms of ServicePrivacy PolicyCookie PolicyContent PolicyCopyright / DMCADisclaimer

Company

AboutContact

Resources

SitemapSitemap XML
Terms of ServicePrivacy PolicyCookie PolicyContent PolicyCopyright / DMCADisclaimer
AboutContact
SitemapSitemap XML
BBobloScript
AccountLog in or create an account to publish scripts.
Log inCreate account

Browse

ScriptsPlacesPopular ScriptsUsers

Script types

Universal scriptsKeyless scriptsKey system scriptsOpen source scripts

Tools

Submit Script

Community

DiscordTelegram
  1. Home
  2. Scripts
  3. Retail Tycoon 2
  4. Retail Tycoon 2 script: Better manager
On this page
Script DescriptionScript FunctionsScript CodeChange LogCommentsRelated scripts
Retail Tycoon 2 script: Better manager script cover for Retail Tycoon 2

Retail Tycoon 2 script: Better manager

Game
Retail Tycoon 21 scripts · 3 place views
Published by
bebraPublished by
Open Roblox Place
·
Open Roblox Place
·
Access
NO KEY
Views
3
Published
Jul 6
Updated
Jul 6
Script author
CLG
  • NO KEY
  • Open Source
  • Mobile Friendly

Retail Tycoon 2 Script Description

Retail Tycoon 2 is not only about building a nice store. The hard part is keeping every product in stock without wasting too much money. If shelves go empty, customers cannot buy what they came for. If you order too much, your cash gets stuck in storage instead of helping you expand the store. The CLG Better Manager script is made to fix that problem with smarter stock control. Instead of relying on slow or inefficient manager behavior, the GUI lets you set a minimum stock value and a restock amount for each product. When an item drops below your selected minimum, the script automatically orders more of it. For example, if Small Furniture goes under 200 stock, the GUI can order 200 more without you checking it manually. This is useful when your store has many different product types and you do not want to open menus every few minutes just to keep everything supplied. The script can manage one product, several products, or every available product in the game. That makes it useful for both smaller stores and bigger tycoons with many shelves, storage areas, and product categories. The search bar also makes it easier to find the item you need instead of scrolling through a huge list. There is no instant delivery option because instant delivery can cut into profit. This setup is better for players who want more efficient restocking, better cash control, and a store that keeps running without wasting money on unnecessary orders. Press Right Shift to hide or show the GUI, or use the buttons in the top-right corner. The script was tested on Potassium and should work on many executors, including lower-level ones like Solara and Xeno, because it does not depend on high-level functions.

Retail Tycoon 2 Script Functions

1 function
  • Better manager

Retail Tycoon 2 Script Code

Lines
609
Size
19.87 KB
Language
Lua

Review before running. Use scripts responsibly.

1local RS = game:GetService("ReplicatedStorage")2local RSvc = game:GetService("RunService")3local TS = game:GetService("TweenService")4local UIS = game:GetService("UserInputService")5local RefrInt = 26local TrackCfg = {}7local GUIVisible = true89local GetStorage = RS:WaitForChild("Remotes", 5):WaitForChild("GetStorage", 5)10local BuyStorage = RS:WaitForChild("Remotes", 5):WaitForChild("BuyStorage", 5)11if not GetStorage or not BuyStorage then12	warn("Remote function failure.")13	return14end1516local Gui = Instance.new("ScreenGui")17Gui.Name = "BtrMgr"18Gui.IgnoreGuiInset = true19Gui.ResetOnSpawn = false20Gui.Parent = gethui()2122local MainFrm = Instance.new("Frame")23MainFrm.Name = "MainFrame"24MainFrm.Size = UDim2.new(0, 600, 0, 500)25MainFrm.Position = UDim2.new(0.5, -300, 0.5, -250)26MainFrm.BackgroundColor3 = Color3.fromRGB(26, 28, 36)27MainFrm.BorderSizePixel = 028MainFrm.ClipsDescendants = true29MainFrm.Parent = Gui3031local MainCnr = Instance.new("UICorner")32MainCnr.CornerRadius = UDim.new(0, 16)33MainCnr.Parent = MainFrm3435local Header = Instance.new("Frame")36Header.Name = "Header"37Header.Size = UDim2.new(1, 0, 0, 60)38Header.BackgroundTransparency = 139Header.ZIndex = 240Header.Parent = MainFrm4142local TitleCont = Instance.new("Frame")43TitleCont.Name = "TitleContainer"44TitleCont.Size = UDim2.new(1, -120, 1, 0)45TitleCont.BackgroundTransparency = 146TitleCont.ZIndex = 247TitleCont.Parent = Header4849local TitleLbl = Instance.new("TextLabel")50TitleLbl.Name = "Title"51TitleLbl.Size = UDim2.new(1, -70, 1, 0)52TitleLbl.Position = UDim2.new(0, 20, 0, 0)53TitleLbl.BackgroundTransparency = 154TitleLbl.Text = "Better Manager"55TitleLbl.Font = Enum.Font.GothamBold56TitleLbl.TextSize = 2057TitleLbl.TextColor3 = Color3.fromRGB(255, 255, 255)58TitleLbl.TextXAlignment = Enum.TextXAlignment.Left59TitleLbl.TextYAlignment = Enum.TextYAlignment.Center60TitleLbl.ZIndex = 261TitleLbl.Parent = TitleCont6263local CredLbl = Instance.new("TextLabel")64CredLbl.Name = "Credits"65CredLbl.Size = UDim2.new(0, 150, 1, 0)66CredLbl.Position = UDim2.new(0, 180, 0, 0)67CredLbl.BackgroundTransparency = 168CredLbl.Text = "v1.0 by Lilah"69CredLbl.Font = Enum.Font.Gotham70CredLbl.TextSize = 1271CredLbl.TextColor3 = Color3.fromRGB(150, 155, 170)72CredLbl.TextXAlignment = Enum.TextXAlignment.Left73CredLbl.TextYAlignment = Enum.TextYAlignment.Center74CredLbl.ZIndex = 275CredLbl.Parent = TitleCont7677local ControlsCont = Instance.new("Frame")78ControlsCont.Name = "Controls"79ControlsCont.Size = UDim2.new(0, 110, 0, 40)80ControlsCont.Position = UDim2.new(1, -120, 0.5, -20)81ControlsCont.BackgroundTransparency = 182ControlsCont.ZIndex = 283ControlsCont.Parent = Header8485local ControlsLyt = Instance.new("UIListLayout")86ControlsLyt.FillDirection = Enum.FillDirection.Horizontal87ControlsLyt.HorizontalAlignment = Enum.HorizontalAlignment.Right88ControlsLyt.VerticalAlignment = Enum.VerticalAlignment.Center89ControlsLyt.Padding = UDim.new(0, 10)90ControlsLyt.Parent = ControlsCont9192local MinBtn = Instance.new("TextButton")93MinBtn.Name = "MinimizeBtn"94MinBtn.Size = UDim2.new(0, 40, 0, 40)95MinBtn.BackgroundColor3 = Color3.fromRGB(40, 43, 54)96MinBtn.BorderSizePixel = 097MinBtn.Text = "—"98MinBtn.Font = Enum.Font.GothamBold99MinBtn.TextSize = 18100MinBtn.TextColor3 = Color3.fromRGB(255, 255, 255)101MinBtn.ZIndex = 2102MinBtn.Parent = ControlsCont103104local MinCnr = Instance.new("UICorner")105MinCnr.CornerRadius = UDim.new(0, 8)106MinCnr.Parent = MinBtn107108local CloseBtn = Instance.new("TextButton")109CloseBtn.Name = "CloseBtn"110CloseBtn.Size = UDim2.new(0, 40, 0, 40)111CloseBtn.BackgroundColor3 = Color3.fromRGB(237, 66, 69)112CloseBtn.BorderSizePixel = 0113CloseBtn.Text = "X"114CloseBtn.TextSize = 20115CloseBtn.Font = Enum.Font.GothamBold116MinBtn.TextSize = 18117CloseBtn.TextColor3 = Color3.fromRGB(255, 255, 255)118CloseBtn.ZIndex = 2119CloseBtn.Parent = ControlsCont120121local CloseCnr = Instance.new("UICorner")122CloseCnr.CornerRadius = UDim.new(0, 8)123CloseCnr.Parent = CloseBtn124125local StatusB = Instance.new("Frame")126StatusB.Name = "StatusBar"127StatusB.Size = UDim2.new(1, -40, 0, 40)128StatusB.Position = UDim2.new(0, 20, 0, 70)129StatusB.BackgroundColor3 = Color3.fromRGB(35, 38, 48)130StatusB.BorderSizePixel = 0131StatusB.ZIndex = 2132StatusB.Parent = MainFrm133134local StatusCnr = Instance.new("UICorner")135StatusCnr.CornerRadius = UDim.new(0, 8)136StatusCnr.Parent = StatusB137138local StatusLbl = Instance.new("TextLabel")139StatusLbl.Name = "StatusText"140StatusLbl.Size = UDim2.new(0.65, -10, 1, 0)141StatusLbl.Position = UDim2.new(0, 10, 0, 0)142StatusLbl.BackgroundTransparency = 1143StatusLbl.Text = " Initializing..."144StatusLbl.Font = Enum.Font.Gotham145StatusLbl.TextSize = 14146StatusLbl.TextColor3 = Color3.fromRGB(180, 185, 200)147StatusLbl.TextXAlignment = Enum.TextXAlignment.Left148StatusLbl.ZIndex = 2149StatusLbl.Parent = StatusB150151local SearchBx = Instance.new("TextBox")152SearchBx.Name = "SearchBox"153SearchBx.Size = UDim2.new(0.35, -10, 0, 30)154SearchBx.Position = UDim2.new(0.65, 5, 0.5, -15)155SearchBx.BackgroundColor3 = Color3.fromRGB(45, 48, 60)156SearchBx.BorderSizePixel = 0157SearchBx.Text = ""158SearchBx.PlaceholderText = " Search Stock..."159SearchBx.Font = Enum.Font.Gotham160SearchBx.TextSize = 14161SearchBx.TextColor3 = Color3.fromRGB(255, 255, 255)162SearchBx.TextXAlignment = Enum.TextXAlignment.Left163SearchBx.TextScaled = true164SearchBx.ClearTextOnFocus = false165SearchBx.ZIndex = 2166SearchBx.Parent = StatusB167168local SearchCnr = Instance.new("UICorner")169SearchCnr.CornerRadius = UDim.new(0, 6)170SearchCnr.Parent = SearchBx171172local ScrollFrm = Instance.new("ScrollingFrame")173ScrollFrm.Name = "StockList"174ScrollFrm.Size = UDim2.new(1, -40, 1, -130)175ScrollFrm.Position = UDim2.new(0, 20, 0, 120)176ScrollFrm.BackgroundTransparency = 1177ScrollFrm.BorderSizePixel = 0178ScrollFrm.ScrollBarThickness = 4179ScrollFrm.ScrollBarImageColor3 = Color3.fromRGB(88, 101, 242)180ScrollFrm.CanvasSize = UDim2.new(0, 0, 0, 0)181ScrollFrm.ZIndex = 2182ScrollFrm.Parent = MainFrm183184local ListLyt = Instance.new("UIListLayout")185ListLyt.Padding = UDim.new(0, 8)186ListLyt.SortOrder = Enum.SortOrder.Name187ListLyt.HorizontalAlignment = Enum.HorizontalAlignment.Center188ListLyt.Parent = ScrollFrm189190ListLyt:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()191	ScrollFrm.CanvasSize = UDim2.new(0, 0, 0, ListLyt.AbsoluteContentSize.Y + 10)192end)193194local function CreateEntry(IName)195	local IFrm = Instance.new("Frame")196	IFrm.Name = IName197	IFrm.Size = UDim2.new(0.95, 0, 0, 80)198	IFrm.BackgroundColor3 = Color3.fromRGB(35, 38, 48)199	IFrm.BorderSizePixel = 0200	IFrm.ClipsDescendants = true201	IFrm.ZIndex = 2202	local ICnr = Instance.new("UICorner")203	ICnr.CornerRadius = UDim.new(0, 10)204	ICnr.Parent = IFrm205	local IStrk = Instance.new("UIStroke")206	IStrk.Color = Color3.fromRGB(50, 54, 68)207	IStrk.Thickness = 1208	IStrk.Transparency = 0.5209	IStrk.ApplyStrokeMode = Enum.ApplyStrokeMode.Border210	IStrk.Parent = IFrm211	local CntFrm = Instance.new("Frame")212	CntFrm.Name = "ContentFrame"213	CntFrm.Size = UDim2.new(1, -20, 1, -20)214	CntFrm.Position = UDim2.new(0, 10, 0, 10)215	CntFrm.BackgroundTransparency = 1216	CntFrm.ZIndex = 2217	CntFrm.Parent = IFrm218	local NameLbl = Instance.new("TextLabel")219	NameLbl.Name = "ItemName"220	NameLbl.Size = UDim2.new(0.35, 0, 0, 25)221	NameLbl.Position = UDim2.new(0, 0, 0, 0)222	NameLbl.BackgroundTransparency = 1223	NameLbl.Text = IName224	NameLbl.Font = Enum.Font.GothamBold225	NameLbl.TextSize = 16226	NameLbl.TextColor3 = Color3.fromRGB(255, 255, 255)227	NameLbl.TextXAlignment = Enum.TextXAlignment.Left228	NameLbl.TextTruncate = Enum.TextTruncate.AtEnd229	NameLbl.ZIndex = 2230	NameLbl.Parent = CntFrm231	local StockLbl = Instance.new("TextLabel")232	StockLbl.Name = "StockAmount"233	StockLbl.Size = UDim2.new(0.35, 0, 0, 20)234	StockLbl.Position = UDim2.new(0, 0, 0, 30)235	StockLbl.BackgroundTransparency = 1236	StockLbl.Text = "Stock: 0"237	StockLbl.Font = Enum.Font.Gotham238	StockLbl.TextSize = 13239	StockLbl.TextColor3 = Color3.fromRGB(150, 155, 170)240	StockLbl.TextXAlignment = Enum.TextXAlignment.Left241	StockLbl.ZIndex = 2242	StockLbl.Parent = CntFrm243	local MinCont = Instance.new("Frame")244	MinCont.Name = "MinContainer"245	MinCont.Size = UDim2.new(0.2, -5, 1, -10)246	MinCont.Position = UDim2.new(0.35, 5, 0, 5)247	MinCont.BackgroundTransparency = 1248	MinCont.ZIndex = 2249	MinCont.Parent = CntFrm250	local MinLbl = Instance.new("TextLabel")251	MinLbl.Size = UDim2.new(1, 0, 0, 18)252	MinLbl.BackgroundTransparency = 1253	MinLbl.Text = "Minimum Stock"254	MinLbl.Font = Enum.Font.Gotham255	MinLbl.TextSize = 11256	MinLbl.TextColor3 = Color3.fromRGB(130, 135, 150)257	MinLbl.TextXAlignment = Enum.TextXAlignment.Left258	MinLbl.ZIndex = 2259	MinLbl.Parent = MinCont260	local MinBx = Instance.new("TextBox")261	MinBx.Name = "MinBox"262	MinBx.Size = UDim2.new(1, 0, 0, 32)263	MinBx.Position = UDim2.new(0, 0, 0, 22)264	MinBx.BackgroundColor3 = Color3.fromRGB(45, 48, 60)265	MinBx.BorderSizePixel = 0266	MinBx.Text = ""267	MinBx.PlaceholderText = "0"268	MinBx.Font = Enum.Font.GothamMedium269	MinBx.TextSize = 14270	MinBx.TextColor3 = Color3.fromRGB(255, 255, 255)271	MinBx.ClearTextOnFocus = false272	MinBx.ZIndex = 2273	MinBx.Parent = MinCont274	local MinBxCnr = Instance.new("UICorner")275	MinBxCnr.CornerRadius = UDim.new(0, 6)276	MinBxCnr.Parent = MinBx277	local RACont = Instance.new("Frame")278	RACont.Name = "RestockContainer"279	RACont.Size = UDim2.new(0.2, -5, 1, -10)280	RACont.Position = UDim2.new(0.55, 5, 0, 5)281	RACont.BackgroundTransparency = 1282	RACont.ZIndex = 2283	RACont.Parent = CntFrm284	local RALbl = Instance.new("TextLabel")285	RALbl.Size = UDim2.new(1, 0, 0, 18)286	RALbl.BackgroundTransparency = 1287	RALbl.Text = "Restock Amount"288	RALbl.Font = Enum.Font.Gotham289	RALbl.TextSize = 11290	RALbl.TextColor3 = Color3.fromRGB(130, 135, 150)291	RALbl.TextXAlignment = Enum.TextXAlignment.Left292	RALbl.ZIndex = 2293	RALbl.Parent = RACont294	local RABx = Instance.new("TextBox")295	RABx.Name = "RestockBox"296	RABx.Size = UDim2.new(1, 0, 0, 32)297	RABx.Position = UDim2.new(0, 0, 0, 22)298	RABx.BackgroundColor3 = Color3.fromRGB(45, 48, 60)299	RABx.BorderSizePixel = 0300	RABx.Text = ""301	RABx.PlaceholderText = "0"302	RABx.Font = Enum.Font.GothamMedium303	RABx.TextSize = 14304	RABx.TextColor3 = Color3.fromRGB(255, 255, 255)305	RABx.ClearTextOnFocus = false306	RABx.ZIndex = 2307	RABx.Parent = RACont308	local RABxCnr = Instance.new("UICorner")309	RABxCnr.CornerRadius = UDim.new(0, 6)310	RABxCnr.Parent = RABx311	local TglBtn = Instance.new("TextButton")312	TglBtn.Name = "ToggleBtn"313	TglBtn.Size = UDim2.new(0.2, -10, 0, 50)314	TglBtn.Position = UDim2.new(0.8, 5, 0.5, -25)315	TglBtn.BackgroundColor3 = Color3.fromRGB(60, 63, 78)316	TglBtn.BorderSizePixel = 0317	TglBtn.Text = "OFF"318	TglBtn.Font = Enum.Font.GothamBold319	TglBtn.TextSize = 14320	TglBtn.TextColor3 = Color3.fromRGB(180, 185, 200)321	TglBtn.ZIndex = 2322	TglBtn.Parent = CntFrm323	local TglCnr = Instance.new("UICorner")324	TglCnr.CornerRadius = UDim.new(0, 8)325	TglCnr.Parent = TglBtn326	local StatusDot = Instance.new("Frame")327	StatusDot.Name = "StatusDot"328	StatusDot.Size = UDim2.new(0, 8, 0, 8)329	StatusDot.Position = UDim2.new(0, 10, 0, 10)330	StatusDot.BackgroundColor3 = Color3.fromRGB(100, 105, 120)331	StatusDot.BorderSizePixel = 0332	StatusDot.ZIndex = 3333	StatusDot.Parent = TglBtn334	local DotCnr = Instance.new("UICorner")335	DotCnr.CornerRadius = UDim.new(1, 0)336	DotCnr.Parent = StatusDot337	return IFrm, NameLbl, StockLbl, MinBx, RABx, TglBtn, IStrk, StatusDot338end339340local IsDrg = false341local DrgStrt, StrtPos342343Header.InputBegan:Connect(function(Inp)344	if Inp.UserInputType == Enum.UserInputType.MouseButton1 or Inp.UserInputType == Enum.UserInputType.Touch then345		IsDrg = true346		DrgStrt = Inp.Position347		StrtPos = MainFrm.Position348	end349end)350351UIS.InputChanged:Connect(function(Inp)352	if353		IsDrg354		and (Inp.UserInputType == Enum.UserInputType.MouseMovement or Inp.UserInputType == Enum.UserInputType.Touch)355	then356		local Delta = Inp.Position - DrgStrt357		MainFrm.Position =358			UDim2.new(StrtPos.X.Scale, StrtPos.X.Offset + Delta.X, StrtPos.Y.Scale, StrtPos.Y.Offset + Delta.Y)359	end360end)361362UIS.InputEnded:Connect(function(Inp)363	if Inp.UserInputType == Enum.UserInputType.MouseButton1 or Inp.UserInputType == Enum.UserInputType.Touch then364		IsDrg = false365	end366end)367368local function AnimateBtn(Btn, HvColor, PrsColor)369	local OrigColor = Btn.BackgroundColor3370	Btn.MouseEnter:Connect(function()371		TS:Create(Btn, TweenInfo.new(0.2), { BackgroundColor3 = HvColor }):Play()372	end)373	Btn.MouseLeave:Connect(function()374		TS:Create(Btn, TweenInfo.new(0.2), { BackgroundColor3 = OrigColor }):Play()375	end)376	Btn.MouseButton1Down:Connect(function()377		TS:Create(Btn, TweenInfo.new(0.1), { BackgroundColor3 = PrsColor }):Play()378	end)379	Btn.MouseButton1Up:Connect(function()380		TS:Create(Btn, TweenInfo.new(0.1), { BackgroundColor3 = HvColor }):Play()381	end)382end383384AnimateBtn(MinBtn, Color3.fromRGB(50, 54, 68), Color3.fromRGB(35, 38, 50))385AnimateBtn(CloseBtn, Color3.fromRGB(255, 80, 82), Color3.fromRGB(220, 50, 52))386387local IsMin = false388local FSize = MainFrm.Size389390MinBtn.MouseButton1Click:Connect(function()391	IsMin = not IsMin392	local TSize = IsMin and UDim2.new(FSize.X.Scale, FSize.X.Offset, 0, 60) or FSize393	MinBtn.Text = IsMin and "" or "—"394	TS:Create(MainFrm, TweenInfo.new(0.3, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), { Size = TSize }):Play()395end)396397CloseBtn.MouseButton1Click:Connect(function()398	local CloseTwn = TS:Create(399		MainFrm,400		TweenInfo.new(0.3, Enum.EasingStyle.Back, Enum.EasingDirection.In),401		{ Size = UDim2.new(0, 0, 0, 0), Position = UDim2.new(0.5, 0, 0.5, 0) }402	)403	CloseTwn:Play()404	CloseTwn.Completed:Connect(function()405		Gui:Destroy()406	end)407end)408409local function ToggleGUI()410	GUIVisible = not GUIVisible411	local TSize = GUIVisible and FSize or UDim2.new(0, 0, 0, 0)412	local TPos = GUIVisible and UDim2.new(0.5, -300, 0.5, -250) or UDim2.new(0.5, 0, 0.5, 0)413	local ES = GUIVisible and Enum.EasingStyle.Back or Enum.EasingStyle.Back414	local ED = GUIVisible and Enum.EasingDirection.Out or Enum.EasingDirection.In415	IsMin = false416	MinBtn.Text = "—"417	TS:Create(MainFrm, TweenInfo.new(0.5, ES, ED), { Size = TSize, Position = TPos }):Play()418end419420UIS.InputBegan:Connect(function(Inp, GPE)421	if Inp.KeyCode == Enum.KeyCode.RightShift and not GPE then422		ToggleGUI()423	end424end)425426local function FilterList(SText)427	local LSText = SText:lower()428	for _, IFrm in ScrollFrm:GetChildren() do429		if IFrm:IsA("Frame") and IFrm.Name ~= "UIListLayout" then430			local IName = IFrm.Name:lower()431			IFrm.Visible = IName:match(LSText) or SText == ""432		end433	end434	ListLyt.AbsoluteContentSize = Vector2.new(0, 0)435end436437SearchBx.Changed:Connect(function(Prop)438	if Prop == "Text" then439		FilterList(SearchBx.Text)440	end441end)442SearchBx.FocusLost:Connect(function()443	FilterList(SearchBx.Text)444end)445446local function GetNum(TBx)447	local Txt = TBx.Text:gsub("[^0-9]", "")448	return tonumber(Txt) or 0449end450451local function UpdCfg(IName, MinS, RAmt)452	TrackCfg[IName] = TrackCfg[IName] or { Min = 0, Restock = 1, Active = false, LastStock = 0, BelowThreshold = false }453	if MinS then454		TrackCfg[IName].Min = math.max(0, math.floor(MinS))455	end456	if RAmt then457		TrackCfg[IName].Restock = math.max(1, math.floor(RAmt))458	end459end460461local function UpdUI(SData)462	for IName, Amt in pairs(SData) do463		local IEntry = ScrollFrm:FindFirstChild(IName)464		if not IEntry then465			local F, NL, SL, MinB, RAB, TglB, Strk, SDot = CreateEntry(IName)466			F.Parent = ScrollFrm467			IEntry = F468			UpdCfg(IName, 0, 1)469			local CntFrm = IEntry:FindFirstChild("ContentFrame")470			local MBCont = CntFrm and CntFrm:FindFirstChild("MinContainer")471			local FMinB = MBCont and MBCont:FindFirstChild("MinBox")472			local RBCont = CntFrm and CntFrm:FindFirstChild("RestockContainer")473			local FRAB = RBCont and RBCont:FindFirstChild("RestockBox")474			local FTglB = CntFrm and CntFrm:FindFirstChild("ToggleBtn")475			local FSDot = FTglB and FTglB:FindFirstChild("StatusDot")476			if FMinB then477				FMinB.FocusLost:Connect(function()478					local V = GetNum(FMinB)479					FMinB.Text = tostring(V)480					UpdCfg(IName, V, nil)481				end)482			end483			if FRAB then484				FRAB.FocusLost:Connect(function()485					local V = GetNum(FRAB)486					FRAB.Text = tostring(V)487					UpdCfg(IName, nil, V)488				end)489			end490			if FTglB and FSDot then491				FTglB.MouseButton1Click:Connect(function()492					local Cfg = TrackCfg[IName]493					Cfg.Active = not Cfg.Active494					local TC = Cfg.Active and Color3.fromRGB(67, 181, 129) or Color3.fromRGB(60, 63, 78)495					local TXC = Cfg.Active and Color3.fromRGB(255, 255, 255) or Color3.fromRGB(180, 185, 200)496					local DC = Cfg.Active and Color3.fromRGB(100, 255, 150) or Color3.fromRGB(100, 105, 120)497					TS:Create(FTglB, TweenInfo.new(0.3), { BackgroundColor3 = TC, TextColor3 = TXC }):Play()498					TS:Create(FSDot, TweenInfo.new(0.3), { BackgroundColor3 = DC }):Play()499					FTglB.Text = Cfg.Active and "ON" or "OFF"500					Cfg.BelowThreshold = false501				end)502				AnimateBtn(503					FTglB,504					TrackCfg[IName].Active and Color3.fromRGB(77, 191, 139) or Color3.fromRGB(70, 73, 88),505					TrackCfg[IName].Active and Color3.fromRGB(57, 171, 119) or Color3.fromRGB(50, 53, 68)506				)507			end508		end509		local CntFrm = IEntry:FindFirstChild("ContentFrame")510		local SL = CntFrm and CntFrm:FindFirstChild("StockAmount")511		local IStrk = IEntry:FindFirstChild("UIStroke")512		local Cfg = TrackCfg[IName]513		if SL and Cfg then514			SL.Text = string.format("Stock: %d", Amt)515			Cfg.LastStock = Amt516			local SC, GC517			if Cfg.Active then518				if Amt <= Cfg.Min then519					SC = Color3.fromRGB(255, 165, 50)520					GC = Color3.fromRGB(255, 140, 50)521				else522					SC = Color3.fromRGB(100, 255, 150)523					GC = Color3.fromRGB(67, 181, 129)524				end525			else526				SC = Color3.fromRGB(150, 155, 170)527				GC = Color3.fromRGB(50, 54, 68)528			end529			TS:Create(SL, TweenInfo.new(0.3), { TextColor3 = SC }):Play()530			TS:Create(IStrk, TweenInfo.new(0.3), { Color = GC }):Play()531		end532	end533end534535local function BuyS(IName, Cfg)536	local CS = Cfg.LastStock or 0537	local MS = Cfg.Min or 0538	local RA = Cfg.Restock or 0539	local Amt = (MS + RA) - CS540	if Amt <= 0 then541		print(string.format("[AR] Skipping %s — stock sufficient.", IName))542		return543	end544	local S, R = pcall(function()545		return BuyStorage:InvokeServer(IName, Amt, false)546	end)547	if S and R then548		StatusLbl.Text = string.format(" Restocked: %s x%d", IName, Amt)549		print(string.format("[AR] Purchased %s x%d.", IName, Amt))550		task.wait(3)551	elseif S then552		StatusLbl.Text = string.format("️ Failed: %s (Msg: %s)", IName, tostring(R))553		warn(string.format("[AR] Purchase failed for %s. Server returned: %s", IName, tostring(R)))554		task.wait(2)555	else556		StatusLbl.Text = string.format(" Error: %s (Err: %s)", IName, tostring(R))557		warn(string.format("[AR] Error for %s: %s", IName, R))558		task.wait(2)559	end560end561562local function Monitor()563	while task.wait(RefrInt) do564		if not RSvc:IsRunning() then565			continue566		end567		local S, D = pcall(function()568			return GetStorage:InvokeServer()569		end)570		if S and type(D) == "table" then571			StatusLbl.Text = " Refreshing stock..."572			UpdUI(D)573			for IName, Cfg in pairs(TrackCfg) do574				if Cfg.Active then575					local CS = Cfg.LastStock576					local MS = Cfg.Min577					if CS <= MS and not Cfg.BelowThreshold then578						Cfg.BelowThreshold = true579						StatusLbl.Text = string.format(" Restocking %s...", IName)580						task.spawn(function()581							BuyS(IName, Cfg)582						end)583					elseif CS > MS and Cfg.BelowThreshold then584						Cfg.BelowThreshold = false585					end586				end587			end588			StatusLbl.Text = string.format(" Idle • Last check: %s", os.date("%H:%M:%S"))589		elseif S then590			warn("GetStorage returned non-table: " .. tostring(D))591			StatusLbl.Text = "️ Invalid data received"592		else593			warn("GetStorage call failed: " .. tostring(D))594			StatusLbl.Text = " Connection error"595		end596	end597end598599MainFrm.Size = UDim2.new(0, 0, 0, 0)600MainFrm.Position = UDim2.new(0.5, 0, 0.5, 0)601602TS:Create(MainFrm, TweenInfo.new(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {603	Size = UDim2.new(0, 600, 0, 500),604	Position = UDim2.new(0.5, -300, 0.5, -250),605}):Play()606607task.delay(0.5, function()608	task.spawn(Monitor)609end)

Retail Tycoon 2 Change Log

1 entries
  1. Jul 06, 2026Publishedbebra

    Script published

Retail Tycoon 2 Comments

…
0/2000
Loading comments…

More Retail Tycoon 2 scripts

Open place hub

No related scripts yet

Other scripts for this place will appear here when they are published.