Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Simple plugin script for detecting clicks not working?

I'm trying to create a custon rotating tool plugin, and my first step is detecting clicks.

However, this script which is supposed to print text for every click, doesn't work, not even returning an exception.


local plugin = PluginManager():CreatePlugin() 
local toolbar = plugin:CreateToolbar("Test")
local newScriptButton = toolbar:CreateButton("Test", "Test", "rbxassetid://1507949215")

local function onNewScriptButtonClicked()
	local mouse = plugin:GetMouse()    -- Gets the PluginMouse 
	mouse.Button1Down:Connect(function()   
		print("Button 1 pressed from PluginMouse")
	end)
end

newScriptButton.Click:Connect(onNewScriptButtonClicked)

1 answer

Nvm. Just found out you have to activate first your plugin e_e

local plugin = PluginManager():CreatePlugin()
local toolbar = plugin:CreateToolbar("Test")
local newScriptButton = toolbar:CreateButton("Test", "Test", "rbxassetid://1507949215")

local function onNewScriptButtonClicked()
	plugin:Activate(true)
	local mouse = plugin:GetMouse()    -- Gets the PluginMouse 
	print("Activated")
	mouse.Button1Down:Connect(function()   
		print("Button 1 pressed from PluginMouse")
	end)
end

newScriptButton.Click:Connect(onNewScriptButtonClicked)

This discussion is preserved as it was. New answers, comments, and votes are closed.