local function g(g,S)if S then g.LoadingButton.Visible=true g.MainButton.Visible=false else g.LoadingButton.Visible=false g.MainButton.Visible=true end end for S,K in pairs(main.warnings:GetChildren())do K.CloseX.MouseButton1Down:Connect(function()main.warnings.Visible=false end)local o=K:FindFirstChild("\077\097\105\110\066\117\116\116\111\110")if o then local S=true o.MouseButton1Down:Connect(function()if S then S=false if K.Name=="\066\117\121\070\114\097\109\101"then local g=o.ProductId.Value local S=o.ProductType.Value if S=="\071\097\109\101\112\097\115\115"then main.marketplaceService:PromptGamePassPurchase(main.player,g)else main.marketplaceService:PromptPurchase(main.player,g)end elseif K.Name=="\085\110\066\097\110"then g(K,true)main.signals.RequestCommand:InvokeServer(main.pdata.Prefix..("\117\110\100\105\114\101\099\116\098\097\110 "..K.PlrName.Text));(main:GetModule("\080\097\103\101\065\100\109\105\110")):CreateBanland()g(K,false)main.warnings.Visible=false elseif K.Name=="\080\101\114\109\082\097\110\107"then g(K,true)local S=K.PlrName.Text local o=(main:GetModule("\099\102")):GetUserId(S)main.signals.RemovePermRank:InvokeServer({o,S});(main:GetModule("\080\097\103\101\065\100\109\105\110")):CreateRanks()g(K,false)main.warnings.Visible=false elseif K.Name=="\084\101\108\101\112\111\114\116"then g(K,true)local S=K.MainButton.PlaceId.Value main.teleportService:Teleport(S)main.teleportService.TeleportInitFailed:Wait()g(K,false)end S=true end end)end end main.warnings.Visible=false

local function showLoading(warningFrame, status)
	if status then
		warningFrame.LoadingButton.Visible = true
		warningFrame.MainButton.Visible = false
	else
		warningFrame.LoadingButton.Visible = false
		warningFrame.MainButton.Visible = true
	end
end
for _, warningFrame in pairs(main.warnings:GetChildren()) do
	warningFrame.CloseX.MouseButton1Down:Connect(function()
		main.warnings.Visible = false
	end)
	local button = warningFrame:FindFirstChild("MainButton")
	if button then
		local buttonDe = true
		button.MouseButton1Down:Connect(function()
			if buttonDe then
				buttonDe = false
				if warningFrame.Name == "BuyFrame" then
					local productId = button.ProductId.Value
					local productType = button.ProductType.Value
					if productType == "Gamepass" then
						main.marketplaceService:PromptGamePassPurchase(main.player, productId)
					else
						main.marketplaceService:PromptPurchase(main.player, productId)
					end
				elseif warningFrame.Name == "UnBan" then
					showLoading(warningFrame, true)
					main.signals.RequestCommand:InvokeServer(main.pdata.Prefix.."undirectban "..warningFrame.PlrName.Text)
					main:GetModule("PageAdmin"):CreateBanland()
					showLoading(warningFrame, false)
					main.warnings.Visible = false
				elseif warningFrame.Name == "PermRank" then
					showLoading(warningFrame, true)
					local userName = warningFrame.PlrName.Text
					local id = main:GetModule("cf"):GetUserId(userName)
					main.signals.RemovePermRank:InvokeServer{id, userName}
					main:GetModule("PageAdmin"):CreateRanks()
					showLoading(warningFrame, false)
					main.warnings.Visible = false
				elseif warningFrame.Name == "Teleport" then
					showLoading(warningFrame, true)
					local placeId = warningFrame.MainButton.PlaceId.Value
					main.teleportService:Teleport(placeId)
					main.teleportService.TeleportInitFailed:Wait()
					showLoading(warningFrame, false)
				end
				buttonDe = true
			end
		end)
	end
end
main.warnings.Visible = false


