Board coding mess

Hey,

I’m encountering a strange issue with my scripts. Initially, everything looked fine, but after coming across an annoying bug on my board, my scripts turned into a mess.

Here’s what’s happening:
I’m creating a board where users can place their items, set a price, and specify the quantity they want to sell. Players have 30-second time to buy the item, and up to 6 other items can be waiting for their turn.

Initially, this setup worked, but now I’m facing a problem where the values (such as item quantity) are getting mixed up. For example, if I place 23x ITEM A on the board and then add 44x ITEM B, it deducts 23 from the ITEM A’s value and then subtracts 44 from the same value (ITEM A).

I attempted to implement a pending system that sends the values back to the local script. It checks for the appearance of the next item offer and, upon detection, resends the same values to try adding the offer to the waiting list (screen.Cominup).

I’m seeking assistance because I’m unsure how to fix this issue and streamline the scripts. As they are a bit lengthy, I’ve provided links to both:
https://dpaste.org/Cky9J#L3,1,463

Additionally, I would greatly appreciate it if you could simplify and condense the code. My coding skills are still developing, and I’ve only been coding for about a year. I do my best to write and improve the simplicity and cleanliness of the code, but any assistance in making it more concise would make me really happy.

:slight_smile:

Nobody is going to click this. Just saying. Could you just paste the script? Maybe as a file?

i clicked it fyi fyi and its sorta big

yeah. it’s big and that’s why I used link system. Well I have text file if you want that:
local script and server script codes…txt (37.4 KB)

well its far too much to debug rn

but i simplified your sever script and began to simplify your localscript

hopefully you can take inspiration and learn from it

and hopefully it somewhat works heh

I’d highly recommend copying your scripts and only adding 2 or 3 items, then try and debug it. That way it will be easier to find what’s wrong as there’s less to sift through. It would also be easier to give that code to others for them to debug.

  • Look through this code
  • Test the server script, debug if necessary
  • Take inspiration from it and condense your local script
  • Get it somewhat working for 2-3 buttons
  • Attempt to debug
  • If you cannot find the issue, send your condensed code here again, maybe editing the question to use the newer code.
-- SERVER SCRIPT --

local images = {
	"rbxassetid://14085555656",	--rareimage
	"rbxassetid://14716948826",	--epicimage
	"rbxassetid://14717101543",	--legendaryimage
	"rbxassetid://14971358701",	--exclusiveimage
	"rbxassetid://15545891280",	--shieldimage
	"rbxassetid://15598046397",	--vipassimage
	"rbxassetid://14763896866", 	--ttTicketimage
	"rbxassetid://15586993560",
	"rbxassetid://15587000207",
	"rbxassetid://15587004973",
	"rbxassetid://15587009892",
	"rbxassetid://15587013605",
	"rbxassetid://15587017990",
	"rbxassetid://15587023725",
	"rbxassetid://15587028019",
	"rbxassetid://15587031382",
	"rbxassetid://15587034799",
	"rbxassetid://15587038053",
}

local screen = game.Workspace.board.screen.SurfaceGui.bg
local copynum = 1
local infonum = 1
screen.item.Visible = false
screen.comingup.nextitem.Visible = false
local pending = false

local notations = {
	{1e3,"K"},
	{1e6,"M"},
	{1e9,"B"},
	{1e12,"T"},
	{1e15,"Qa"},
	{1e18,"Qi"},
	{1e21,"Sx"},
	{1e24,"Sp"},
	{1e27,"Oc"},
	{1e30,"No"}
}

local function formatNumber(number)

	number = tonumber(number) or 0

	local num_string = tostring(number)
	for notation = 1, #notations, 1 do
		local min = notations[notation][1]
		local max = notations[math.clamp(notation + 1, 1, #notations)][1]
		if number >= min and number < max then
			local new_number = math.round((number / min) * 10) / 10
			num_string = tostring(new_number)
			return num_string .. notations[notation][2]
		end
	end
	return num_string
end

local function getStuff(plr)
	local boksit = plr:WaitForChild('Boksit')
	local titlet = plr:WaitForChild('Titlet')

	local stuff = {
		boksit:FindFirstChild("Rare"),
		boksit:FindFirstChild("Epic"),
		boksit:FindFirstChild("Legendary"),
		boksit:FindFirstChild("Exclusive"),

		plr:WaitForChild("otherItems"):FindFirstChild("Shield"),
		boksit:FindFirstChild("vipass"),
		titlet:FindFirstChild("tt"),

		titlet.r1, titlet.r2, titlet.r3, titlet.r4,
		titlet.s1, titlet.s2,
		titlet.e1, titlet.e2,
		titlet.l1, titlet.l2,
		titlet.m,
	}
	
	return stuff
end

local boardEvents = game.ReplicatedStorage.boardevents
boardEvents.leave.OnServerEvent:Connect(function()

end)

boardEvents.success.OnServerEvent:Connect(function()

end)

boardEvents.sendoffer.OnServerEvent:Connect(function(player, plr, item, cost, itemname, itemamount)
	if pending == false then
		pending = true
		
		local stuff = getStuff(plr)

		if copynum == 7 then
			warn("ALL USED")
		else

			local copynext = screen.comingup.nextitem:Clone()
			copynext.Parent = screen.comingup
			copynext.Visible = true
			copynext.Name = "copy" .. copynum
			copynext.cost.Text = cost
			
			local costText = copynext.cost.Text
			local costNumber = tonumber(costText) or 0
			copynext.cost.Text = formatNumber(costNumber)
			copynext.plr.Text = plr.Name
			copynext.item.Text = item
			
			local copyinfo = screen.comingup.infos:Clone()
			copyinfo.Name = "info" .. infonum
			copyinfo.Parent = screen.comingup
			copyinfo.itemvalue.Text = item
			copyinfo.itemamount.Text = itemamount
			copynum = copynum + 1
			infonum = infonum + 1
			
			print("INFONUM IS " .. infonum)
			copynext.name.Text = itemname .. " " .. itemamount .. "x"
			
			if item >= 1 and item <= 18 then
				copynext.Image = images[item]
			end
			
			local amountof = tonumber(itemamount)
			
			if item >= 1 and item <= 18 then
				stuff[item] -= amountof
			end
			
			pending = false
		end
	else
		boardEvents.pending:FireClient(plr, item, cost, itemname, itemamount)
	end

end)

local timeleft = 30
local function timer()
	timeleft = timeleft - 1
	screen.time.Text = "0 min  " .. timeleft .. " sec"
	if timeleft < 5 then
		screen.time.TextColor3 = Color3.fromRGB(255, 0, 4)
		screen.time.UIStroke.Color = Color3.fromRGB(132, 0, 2)
	elseif timeleft < 15 then
		screen.time.TextColor3 = Color3.fromRGB(255, 128, 0)
		screen.time.UIStroke.Color = Color3.fromRGB(132, 44, 0)
	end
end

game.Players.PlayerRemoving:Connect(function(plr)
	local copy1 = screen.comingup:FindFirstChild("copy1")
	local info1 = screen.comingup:FindFirstChild("info0")
	if copy1 and plr.Name == copy1.plr.Text then
		local stuff = getStuff(plr)

		local item = tonumber(info1.itemvalue.Text)
		local amountof = tonumber(info1.itemamount.Text)
		
		if item == nil or item <1 or item > 18 then
			warn("NOTHING. " .. item)
		else
			stuff[item].Value += amountof
		end
		
		info1:Destroy()
	end
end)

local timelock = true
while true do
	wait(1)
	if screen.item.Visible == false then

		wait(2)
		local copy1 = screen.comingup:FindFirstChild("copy1")
		if copy1 then
			local image = copy1.Image
			pending = true
			screen.time.Text = "1 min 00 sec"
			screen.item.Image = image
			screen.item.Visible = true
			screen.cost.gems.Text = copy1.cost.Text
			screen.itemname.Text = copy1.name.Text
			screen.plrname.Text = copy1.plr.Text .. "'s"
			screen.sellingfor.Visible = true
			screen.cost.Visible = true
			screen.buy.Visible = true
			screen.plrname.Visible = true
			copy1:Destroy()
			copynum = copynum - 1
			infonum = infonum - 1
			timeleft = 30
			screen.time.TextColor3 = Color3.fromRGB(255, 255, 255)
			screen.time.UIStroke.Color = Color3.fromRGB(132, 132, 132)
			timelock = false

			local info1 = screen.comingup:FindFirstChild("info1")
			if info1 then

				info1.Name = "info0"

			end
			local copy2 = screen.comingup:FindFirstChild("copy2")
			local info2 = screen.comingup:FindFirstChild("info2")
			if copy2 then
				copy2.Name = "copy1"
				info2.Name = "info1"

			end
			local copy3 = screen.comingup:FindFirstChild("copy3")
			local info3 = screen.comingup:FindFirstChild("info3")
			if copy3 then
				copy3.Name = "copy2"
				info3.Name = "info2"
			end
			local copy4 = screen.comingup:FindFirstChild("copy4")
			local info4 = screen.comingup:FindFirstChild("info4")
			if copy4 then
				copy4.Name = "copy3"
				info4.Name = "info3"
			end
			local copy5 = screen.comingup:FindFirstChild("copy5")
			local info5 = screen.comingup:FindFirstChild("info5")
			if copy5 then
				copy5.Name = "copy4"
				info5.Name = "info4"
			end
			local copy6 = screen.comingup:FindFirstChild("copy6")
			local info6 = screen.comingup:FindFirstChild("info6")
			if copy6 then
				copy6.Name = "copy5"
				info6.Name = "info5"
			end
			local copy7 = screen.comingup:FindFirstChild("copy7")
			local info7 = screen.comingup:FindFirstChild("info7")
			if copy7 then
				copy7.Name = "copy6"
				info7.Name = "info6"
			end
			pending = false
		else
			timelock = true
			timeleft = 0
			screen.time.TextColor3 = Color3.fromRGB(255, 255, 255)
			screen.time.UIStroke.Color = Color3.fromRGB(132, 132, 132)
			screen.cost.gems.Text = ""
			screen.itemname.Text = "Put the item up for sale."
			screen.plrname.Text = ""
			screen.sellingfor.Visible = false
			screen.cost.Visible = false
			screen.item.Visible = false
			screen.buy.Visible = false
		end
	end
	if timelock == false then
		if timeleft == 0 then
			screen.buy.Visible = false
			local info1 = screen.comingup:FindFirstChild("info0")
			screen.sellingfor.Visible = false
			screen.cost.Visible = false
			screen.item.Visible = false
			screen.plrname.Visible = false
			local fullname = screen.plrname.Text
			local plrrname = fullname:sub(1, fullname:find("'s") - 1)
			local item = tonumber(info1.itemvalue.Text)
			print(item .. "IS ITEM'S VALUE")
			screen.itemname.Text = "TIMES UP!"
			local plrr = game.Players:FindFirstChild(plrrname)
			print(plrr)

			local stuff = getStuff(plrr)
			
			print(stuff[7].Value .. " is title's value")
			print(item)
			
			local amountof = tonumber(info1.itemamount.Text)
			if item == nil or item <1 or item > 18 then
				warn("NOTHING. " .. item)
			else
				stuff[item].Value += amountof
			end
			info1:Destroy()

		else
			timer(timeleft)
		end
	end
end

-- LOCAL SCRIPT -- 

local screen = game.Workspace.board.screen.SurfaceGui.bg
local buy = screen.buy
local add = screen.add
local item = screen.item
local timer = screen.time
local itemname = screen.itemname
local sellingframe = screen.cost
local price = sellingframe.gems
local nextitem = screen.comingup.nextitem


local sendingamount = 0
local sendingitem = "nothing"
local choosedamount = 0

local priceframe = script.Parent.ScreenGui.priceframe
local priceexit = priceframe.exit
local priceinsert = priceframe.insert
local priceprice = priceframe.price

local selectframe = script.Parent.ScreenGui.Frame
local search = selectframe.searchbar
local allitems = selectframe.ScrollingFrame
local nextbutton = selectframe.next
local selectexit = selectframe.exit
local marked = script.Parent.marked



local amountframe = script.Parent.ScreenGui.amountframe
local amount = amountframe.amount
local amountnext = amountframe.next
local amountexit = amountframe.exit
local amountall = amountframe.all

local imNotSure = {
	allitems["rare kiulu"],
	allitems["epic kiulu"],
	allitems["legendary kiulu"],
	allitems["exclusive kiulu"],
	allitems["shield"],
	allitems["VIP-Pass"],
	allitems["tt-ticket"],
	allitems["squirrel"],
	allitems["coder"],
	allitems["sauna"],
	allitems["QWERTY"],
	allitems["helper"],
	allitems["nut"],
	allitems["epic"],
	allitems["creative"],
	allitems["master"],
	allitems["m3cha"],
	allitems["custom"],
}

local plr = game.Players.LocalPlayer
local tt = script.Parent.Parent.KaikkiScreenNapit.Inventory.tausta.hiiret
local r1 = tt.r1
local r2 = tt.r2
local r3 = tt.r3
local r4 = tt.r4
local s1 = tt.s1
local s2 = tt.s2
local e1 = tt.e1
local e2 = tt.e2
local l1 = tt.l1
local l2 = tt.l2
local m = tt.m
local tvip = tt.vip
local choosedvalue = 0

local boksit = plr:WaitForChild('Boksit')
local titlet = plr:WaitForChild('Titlet')

local stuff = {
	boksit:FindFirstChild("Rare"),
	boksit:FindFirstChild("Epic"),
	boksit:FindFirstChild("Legendary"),
	boksit:FindFirstChild("Exclusive"),

	plr:WaitForChild("otherItems"):FindFirstChild("Shield"),
	boksit:FindFirstChild("vipass"),
	titlet:FindFirstChild("tt"),

	titlet.r1, titlet.r2, titlet.r3, titlet.r4,
	titlet.s1, titlet.s2,
	titlet.e1, titlet.e2,
	titlet.l1, titlet.l2,
	titlet.m,
}

local tags = {
	'Rare Kiulu', 'Epic Kiulu', 'Legendary Kiulu', 'Exclusive Kiulu',
	'Shield', 'Vip-Pass', 'TT-Ticket',
	'Squirrel TITLE',
	'Coder TITLE',
	'Sauna TITLE',
	'QWERTY TITLE',
	'Nut TITLE',
	'Helper TITLE',
	'Epic TITLE',
	'Creative TITLE',
	'Master TITLE',
	'M3CHA TITLE',
	'Custom TITLE',
}

local function toggleButtons(enabled:boolean)
	local screen = script.Parent.Parent.KaikkiScreenNapit
	screen.Inventory.Enabled = enabled
	screen.SaunaCoinBG.Enabled = enabled
	screen.SaunaGemBG.Enabled = enabled
	screen.SaunaRebirthBG.Enabled = enabled
	screen.SaunaCrownBG.Enabled = enabled
	screen.kauppa.Enabled = enabled
	screen.nopeus.nopeusonoff.Visible = enabled
	screen.palkintosysteemi.Enabled = enabled
	screen.settingi.Enabled = enabled
	screen.style3.Enabled = enabled
	screen.tasks.Enabled = enabled
	screen.teleportt.Enabled = enabled
end

local sound1 = script.Parent.ScreenGui.Frame.Sound
add.MouseButton1Click:Connect(function()
	selectframe.Visible = true
	toggleButtons(false)
end)

selectframe.Visible = false
selectexit.MouseButton1Click:Connect(function()
	toggleButtons(true)
	selectframe.Visible = false

end)

amountexit.MouseButton1Click:Connect(function()
	toggleButtons(true)
	amountframe.Visible = false
end)

amountframe.Visible = false
priceframe.Visible = false
nextbutton.MouseButton1Click:Connect(function()
	if nextbutton.BackgroundColor3 == Color3.fromRGB(143, 221, 255) and marked.Parent.Visible == true then
		amountframe.Visible = true
		selectframe.Visible = false
	end
end)

for i, thing:GuiButton in stuff do
	thing.MouseButton1Up:Connect(function()
		marked.Parent = imNotSure[i]
		choosedvalue = i
		sound1:Play()
		sendingitem = tags[i]
		choosedamount = stuff[i].value
	end)
end

local function isNumeric(str)
	local num = tonumber(str)
	return num ~= nil
end

amountnext.MouseButton1Click:Connect(function()
	local userInput = amount.Text

	if isNumeric(userInput) then
		local userInput2 = tonumber(userInput)
		if userInput2 > choosedamount then
			amount.Text = choosedamount

		end
		sendingamount = userInput2
		amountframe.Visible = false
		priceframe.Visible = true
	else
		amount.TextColor3 = Color3.fromRGB(200, 0, 3)
		amount.UIStroke.Color = Color3.fromRGB(129, 0, 2)
		wait(1)
		amount.TextColor3 = Color3.fromRGB(255, 255, 255)
		amount.UIStroke.Color = Color3.fromRGB(85, 79, 79)
	end
end)

local function sending(plr, item, cost, itemname, itemamount)
	if screen.item.Visible == true and not screen.comingup:FindFirstChild("copy6") and not screen.comingup:FindFirstChild("copy7") then
		local event = game.ReplicatedStorage.boardevents.sendoffer

		event:FireServer(plr, item, cost, itemname, itemamount)
	else
	end
end

game.ReplicatedStorage.boardevents.pending.OnClientEvent:Connect(function(player, plr, item, cost, itemname, itemamount)
	print(player, plr, item, cost, itemname, itemamount)
	while screen.item.Visible == false do
		wait(1)
		sending(plr, item, cost, itemname, itemamount)


	end
end)
amount.FocusLost:Connect(function()
	local userInput = amount.Text
	local userInput2 = tonumber(userInput)
	print(choosedamount .. " IS THE AMOUNT")
	if userInput2 > choosedamount then
		amount.Text = choosedamount

	end
	sendingamount = userInput2
end)
amountall.MouseButton1Click:Connect(function()
	local userInput = amount.Text
	amount.Text = choosedamount
	local userInput2 = tonumber(userInput)
	sendingamount = choosedamount
end)
local function expandShortNumber(shortNumber)
	local multiplier = 1
	local lastChar = shortNumber:sub(-1)

	if lastChar:match("[%d]") then
		return tonumber(shortNumber)
	elseif lastChar:match("[.,]") then
		multiplier = 1
		shortNumber = shortNumber:gsub(",", ".")
	elseif lastChar:match("[Kk]") then
		multiplier = 1e3
	elseif lastChar:match("[Mm]") then
		multiplier = 1e6
	elseif lastChar:match("[Bb]") then
		multiplier = 1e9
	elseif lastChar:match("[Tt]") then
		multiplier = 1e12
	elseif lastChar:match("[Qq][Aa]") then
		multiplier = 1e15
	elseif lastChar:match("[Qi]") then
		multiplier = 1e18
	elseif lastChar:match("[Ss][Xx]") then
		multiplier = 1e21
	elseif lastChar:match("[Ss][Pp]") then
		multiplier = 1e24

	else
		return tonumber(shortNumber)
	end

	local numberPart = shortNumber:sub(1, -2)
	return tonumber(numberPart) * multiplier
end
local function validateInput(input)
	return input:match("^%d+$") ~= nil
end
local function updateNumber()
	local enteredText = priceprice.Text
	local expandedNumber = expandShortNumber(enteredText)

	if expandedNumber then
		priceprice.Text = tostring(expandedNumber)

	end
end
priceprice.FocusLost:Connect(updateNumber)


priceexit.MouseButton1Click:Connect(function()
	priceframe.Visible = false
	toggleButtons(true)
end)

priceinsert.MouseButton1Click:Connect(function()
	local enteredText = priceprice.Text

	if validateInput(enteredText) then
		priceframe.Visible = false
		toggleButtons(true)
		local event = game.ReplicatedStorage.boardevents.sendoffer

		event:FireServer(plr, choosedvalue, enteredText, sendingitem, sendingamount)

	else
		priceprice.TextColor3 = Color3.fromRGB(255, 0, 4)
		wait(1)
		priceprice.TextColor3 = Color3.fromRGB(198, 83, 255)
	end
end)

buy.MouseButton1Click:Connect(function()

end)

local function updatePositions()
	local text = search.Text:lower()
	if text ~= "" then -- if it has text
		local buttons = allitems:GetDescendants() -- all of the buttons
		for _, button in pairs(buttons) do -- loops through the buttons
			if button:IsA("TextButton") or button:IsA("ImageButton") then -- if it's a button
				local buttonText = button.Name:lower() -- lowercase button text
				if string.find(buttonText, text) then -- if search bar text is found in the button's text

					button.Visible = true -- shows button
					if m.BackgroundColor3 ~= Color3.fromRGB(181, 0, 3) then

						custom.Visible = false
					end

					if l1.BackgroundColor3 ~= Color3.fromRGB(255, 170, 0) then
						master.Visible = false

					end

					if l2.BackgroundColor3 ~= Color3.fromRGB(255, 170, 0) then
						m3cha.Visible = false

					end
					if e1.BackgroundColor3 ~= Color3.fromRGB(127, 42, 255) then
						epict.Visible = false

					end

					if e2.BackgroundColor3 ~= Color3.fromRGB(127, 42, 255) then
						creative.Visible = false

					end

					if s1.BackgroundColor3 ~= Color3.fromRGB(32, 140, 255) then
						nut.Visible = false

					end

					if s2.BackgroundColor3 ~= Color3.fromRGB(32, 140, 255) then
						helper.Visible = false

					end

					if r1.BackgroundColor3 ~= Color3.fromRGB(2, 255, 179) then
						squirrel.Visible = false

					end

					if r2.BackgroundColor3 ~= Color3.fromRGB(2, 255, 179) then
						coder.Visible = false
					end
					if r3.BackgroundColor3 ~= Color3.fromRGB(2, 255, 179) then
						sauna.Visible = false
					end
					if r4.BackgroundColor3 ~= Color3.fromRGB(2, 255, 179) then
						QWERTY.Visible = false

					end
					if vlegendary.Value == 0 then
						legendary.Visible = false
					end
					if vexclusive.Value == 0 then
						exclusive.Visible = false
					end
					if vepic.Value == 0 then
						epic.Visible = false
					end

					if vrare.Value == 0 then
						rare.Visible = false
					end

					if vshield.Value == 0 then
						shield.Visible = false
					end

					if vvipass.Value == 0 then
						vipass.Visible = false
					end

					if vttTicket.Value == 0 then
						ttTicket.Visible = false
					end
				else -- otherwise
					button.Visible = false -- hides button
				end
			end
		end
	else -- if it's empty
		local buttons = allitems:GetDescendants() -- all buttons
		for _, button in pairs(buttons) do -- loops through buttons
			if button:IsA("TextButton") or button:IsA("ImageButton") then -- if it's a button
				button.Visible = true -- shows button
				if m.BackgroundColor3 ~= Color3.fromRGB(181, 0, 3) then

					custom.Visible = false
				end

				if l1.BackgroundColor3 ~= Color3.fromRGB(255, 170, 0) then
					master.Visible = false

				end

				if l2.BackgroundColor3 ~= Color3.fromRGB(255, 170, 0) then
					m3cha.Visible = false

				end
				if e1.BackgroundColor3 ~= Color3.fromRGB(127, 42, 255) then
					epict.Visible = false

				end

				if e2.BackgroundColor3 ~= Color3.fromRGB(127, 42, 255) then
					creative.Visible = false

				end

				if s1.BackgroundColor3 ~= Color3.fromRGB(32, 140, 255) then
					nut.Visible = false

				end

				if s2.BackgroundColor3 ~= Color3.fromRGB(32, 140, 255) then
					helper.Visible = false

				end

				if r1.BackgroundColor3 ~= Color3.fromRGB(2, 255, 179) then
					squirrel.Visible = false

				end

				if r2.BackgroundColor3 ~= Color3.fromRGB(2, 255, 179) then
					coder.Visible = false
				end
				if r3.BackgroundColor3 ~= Color3.fromRGB(2, 255, 179) then
					sauna.Visible = false
				end
				if r4.BackgroundColor3 ~= Color3.fromRGB(2, 255, 179) then
					QWERTY.Visible = false

				end
				if vlegendary.Value == 0 then
					legendary.Visible = false
				end
				if vexclusive.Value == 0 then
					exclusive.Visible = false
				end
				if vepic.Value == 0 then
					epic.Visible = false
				end

				if vrare.Value == 0 then
					rare.Visible = false
				end

				if vshield.Value == 0 then
					shield.Visible = false
				end

				if vvipass.Value == 0 then
					vipass.Visible = false
				end

				if vttTicket.Value == 0 then
					ttTicket.Visible = false
				end
			end
		end
	end
end


search:GetPropertyChangedSignal("Text"):Connect(function()
	updatePositions()
end)




if m.BackgroundColor3 == Color3.fromRGB(181, 0, 3) then
	custom.Visible = true
else
	custom.Visible = false
end

if l1.BackgroundColor3 == Color3.fromRGB(255, 170, 0) then
	master.Visible = true
else
	master.Visible = false

end

if l2.BackgroundColor3 == Color3.fromRGB(255, 170, 0) then
	m3cha.Visible = true
else
	m3cha.Visible = false

end
if e1.BackgroundColor3 == Color3.fromRGB(127, 42, 255) then
	epict.Visible = true
else
	epict.Visible = false

end

if e2.BackgroundColor3 == Color3.fromRGB(127, 42, 255) then
	creative.Visible = true
else
	creative.Visible = false

end

if s1.BackgroundColor3 == Color3.fromRGB(32, 140, 255) then
	nut.Visible = true
else
	nut.Visible = false

end

if s2.BackgroundColor3 == Color3.fromRGB(32, 140, 255) then
	helper.Visible = true
else
	helper.Visible = false

end

if r1.BackgroundColor3 == Color3.fromRGB(2, 255, 179) then
	squirrel.Visible = true
else
	squirrel.Visible = false

end

if r2.BackgroundColor3 == Color3.fromRGB(2, 255, 179) then
	coder.Visible = true
else
	coder.Visible = false
end
if r3.BackgroundColor3 == Color3.fromRGB(2, 255, 179) then
	sauna.Visible = true
else
	sauna.Visible = false
end
if r4.BackgroundColor3 == Color3.fromRGB(2, 255, 179) then
	QWERTY.Visible = true
else
	QWERTY.Visible = false

end
if vlegendary.Value >= 1 then
	legendary.Visible = true
else
	legendary.Visible = false
end
if vexclusive.Value >= 1 then
	exclusive.Visible = true
else
	exclusive.Visible = false
end
if vepic.Value >= 1 then
	epic.Visible = true
else
	epic.Visible = false
end

if vrare.Value >= 1 then
	rare.Visible = true
else
	rare.Visible = false
end

if vshield.Value >= 1 then
	shield.Visible = true
else
	shield.Visible = false
end

if vvipass.Value >= 1 then
	vipass.Visible = true
else
	vipass.Visible = false
end

if vttTicket.Value >= 1 then
	ttTicket.Visible = true
else
	ttTicket.Visible = false
end




title11.Changed:Connect(function()
	if m.BackgroundColor3 == Color3.fromRGB(181, 0, 3) then
		custom.Visible = true
	else
		custom.Visible = false
	end
end)
title9.Changed:Connect(function()
	if l1.BackgroundColor3 == Color3.fromRGB(255, 170, 0) then
		master.Visible = true
	else
		master.Visible = false

	end
end)
title10.Changed:Connect(function()
	if l2.BackgroundColor3 == Color3.fromRGB(255, 170, 0) then
		m3cha.Visible = true
	else
		m3cha.Visible = false

	end
end)
title7.Changed:Connect(function()
	if e1.BackgroundColor3 == Color3.fromRGB(127, 42, 255) then
		epict.Visible = true
	else
		epict.Visible = false

	end
end)
title8.Changed:Connect(function()
	if e2.BackgroundColor3 == Color3.fromRGB(127, 42, 255) then
		creative.Visible = true
	else
		creative.Visible = false

	end
end)
title5.Changed:Connect(function()
	if s1.BackgroundColor3 == Color3.fromRGB(32, 140, 255) then
		nut.Visible = true
	else
		nut.Visible = false

	end
end)
title6.Changed:Connect(function()
	if s2.BackgroundColor3 == Color3.fromRGB(32, 140, 255) then
		helper.Visible = true
	else
		helper.Visible = false

	end
end)
title1.Changed:Connect(function()
	if r1.BackgroundColor3 == Color3.fromRGB(2, 255, 179) then
		squirrel.Visible = true
	else
		squirrel.Visible = false

	end
end)
title2.Changed:Connect(function()
	if r2.BackgroundColor3 == Color3.fromRGB(2, 255, 179) then
		coder.Visible = true
	else
		coder.Visible = false
	end
end)
title3.Changed:Connect(function()
	if r3.BackgroundColor3 == Color3.fromRGB(2, 255, 179) then
		sauna.Visible = true
	else
		sauna.Visible = false
	end
end)
title4.Changed:Connect(function()
	if r4.BackgroundColor3 == Color3.fromRGB(2, 255, 179) then
		QWERTY.Visible = true
	else
		QWERTY.Visible = false

	end
end)
vlegendary.Changed:Connect(function()
	if vlegendary.Value >= 1 then
		legendary.Visible = true
	else
		legendary.Visible = false
	end
end)
vexclusive.Changed:Connect(function()
	if vexclusive.Value >= 1 then
		exclusive.Visible = true
	else
		exclusive.Visible = false
	end
end)
vepic.Changed:Connect(function()	
	if vepic.Value >= 1 then
		epic.Visible = true
	else
		epic.Visible = false
	end
end)
vrare.Changed:Connect(function()
	if vrare.Value >= 1 then
		rare.Visible = true
	else
		rare.Visible = false
	end
end)
vshield.Changed:Connect(function()
	if vshield.Value >= 1 then
		shield.Visible = true
	else
		shield.Visible = false
	end
end)
vvipass.Changed:Connect(function()
	if vvipass.Value >= 1 then
		vipass.Visible = true
	else
		vipass.Visible = false
	end
end)
vttTicket.Changed:Connect(function()
	if vttTicket.Value >= 1 then
		ttTicket.Visible = true
	else
		ttTicket.Visible = false
	end
end)

while true do
	wait()
	if marked.Parent == script.Parent then
		nextbutton.BackgroundColor3 = Color3.fromRGB(48, 75, 81)
	else
		nextbutton.BackgroundColor3 = Color3.fromRGB(143, 221, 255)
	end
end


1 Like