Fetching information from the site in a script conflicts with PluginMenus

Any plugin that makes use of PluginMenus will fail to display properly from using ShowAsync() if it also uses require() with an ID, or using MarketPlaceService to get information on an asset. However, using require() with a ModuleScript inside of the script will work just fine, or you can use the same exact code and use it in the command bar and it will function as intended.

Here’s how to replicate the bug:

------||VARIABLES
local Code = require(3165359492)
--For example-sake Code isn't used.
--Services
local Selections = game:GetService("Selection")
----Essentials
local ToolBar = plugin:CreateToolbar("Flood Escape 2")
local Button = ToolBar:CreateButton("Map Making Assistant","WIP","rbxassetid://2195531164")
local Mouse = plugin:GetMouse()
local deb = false
----Plugin Menus
local PluginMenu = plugin:CreatePluginMenu(math.random(),"Test Menu") PluginMenu.Name = "Water Menu"
PluginMenu:AddNewAction("ActionA","A","rbxassetid://3880356701")
PluginMenu:AddNewAction("ActionB","B","rbxassetid://3880357001")
------||COMMANDS
----||Selection Listener
local function Selecting() --if not on then return end (ignored for now)
local Selected = Selections:Get()[1]
	if Selected and Selected:IsA("BasePart") then
	local Action = PluginMenu:ShowAsync()
		if Action then print("Action made:",Action.Text)
		else print("No action was taken.")
		end
	end
end
----||Button and Toolbar
function ButtonClick()
lastClicked = tick()
on = not on
plugin:Activate(on)
Button:SetActive(on)
end
------||CONNECTIONS
Button.Click:Connect(ButtonClick)
Selections.SelectionChanged:Connect(Selecting)

plugin.Deactivation:Connect(function()
	if not deb and (tick()-lastClicked)>1 then
	deb = true
		if on then on = false end
	plugin:Activate(false)
	Button:SetActive(false)
	wait()
	deb = false
	end
end)

Removing the line local Code = require(3165359492), or replacing the ID with a reference to an existing ModuleScript will not cause it to fail, however.

Working Example
------||VARIABLES
--Services
local Selections = game:GetService("Selection")
----Essentials
local ToolBar = plugin:CreateToolbar("Flood Escape 2")
local Button = ToolBar:CreateButton("Map Making Assistant","WIP","rbxassetid://2195531164")
local Mouse = plugin:GetMouse()
local deb = false
----Plugin Menus
local PluginMenu = plugin:CreatePluginMenu(math.random(),"Test Menu") PluginMenu.Name = "Water Menu"
PluginMenu:AddNewAction("ActionA","A","rbxassetid://3880356701")
PluginMenu:AddNewAction("ActionB","B","rbxassetid://3880357001")
------||COMMANDS
----||Selection Listener
local function Selecting() --if not on then return end (ignored for now)
local Selected = Selections:Get()[1]
	if Selected and Selected:IsA("BasePart") then
	local Action = PluginMenu:ShowAsync()
		if Action then print("Action made:",Action.Text)
		else print("No action was taken.")
		end
	end
end
----||Button and Toolbar
function ButtonClick()
lastClicked = tick()
on = not on
plugin:Activate(on)
Button:SetActive(on)
end
------||CONNECTIONS
Button.Click:Connect(ButtonClick)
Selections.SelectionChanged:Connect(Selecting)

plugin.Deactivation:Connect(function()
	if not deb and (tick()-lastClicked)>1 then
	deb = true
		if on then on = false end
	plugin:Activate(false)
	Button:SetActive(false)
	wait()
	deb = false
	end
end)

This occurs 100% of the time, and I’m unsure of when this bug had started. I’ve only been using this feature very recently.

1 Like

This topic was automatically closed after 1 minute. New replies are no longer allowed.