Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Simple plugin script for detecting clicks not working?

Asked by 5 years ago

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

Log in to vote
0
Answered by 5 years ago

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)

Ad

Answer this question