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

Does anyone know how to get the mouse in a plugin?

Asked by 9 years ago

I'm trying to find the mouse of the player inside a plugin Does anyone know how to get the mouse of a person who pressed a plugin?

local plugin = PluginManager():CreatePlugin()
local toolbar = plugin:CreateToolbar("test")
local button = toolbar:CreateButton("test", "test", "test.png")

button.Click:connect(function()
    mouse = GetMouse()
    mouse.Button1Down:connect(function()  --This isn't working 
        print("Button 1 pressed from PluginMouse")
    end)
end)
0
What's the error? Senor_Chung 210 — 9y
1
You have to call 'GetMouse()' on 'plugin', for instance, 'local mouse = plugin:GetMouse()' Muoshuu 580 — 9y
0
If that answered your question, please put 'Answered' in the title. Muoshuu 580 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

Plugin manager is no longer required as Plugin is a global keyword even though it recognizes it as a unknown global use

In a ModuleScript

local Mouse=Plugin:GetMouse()

to get the mouse but you have to test it as a regular function for it to work.

0
Please rep if you like the answer nstrike159 15 — 9y
Ad

Answer this question