To protect the source of the plugin I have the plugin use a loader type method, the module doesn't return a table of functions it runs on require(), to get the mouse object in the module I make the plugin loader put the mouse in a object value then put the object value in the coregui. The module then finds the object value and gets the mouse. The mouse works sort of I can get the mouse.Hit.p position but the events such as Button1Down and Button1Up do not work, No error or output is shown.
I've been using this to test it
spawn(function() -- Heavily commented because its not working
print("1")
print(Mouse) -- Prints instance
Mouse.Button1Down:connect(function()
PaintLoop = true
print("M1Down")
end)
Mouse.Button1Up:connect(function()
PaintLoop = false
print("M1Up")
end)
end)
1 does print, print(Mouse) prints "Instance" Both down and up functions never get called nor print anything.

1 comment
Have you defined Mouse?