Advertisement
Scriptorz5

virtual click

May 18th, 2022
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. local module = {};
  2. local methods = {};
  3. methods.__index = methods;
  4.  
  5. function module.new(name, text)
  6. local newButton = {};
  7. newButton.Name = name;
  8. local ButtonInstance = Instance.new("TextButton");
  9. ButtonInstance.Text = text;
  10. newButton._btn = ButtonInstance;
  11. local Bind = Instance.new("BindableEvent");
  12. newButton.Clicked = Bind.Event;
  13. newButton._event = Bind;
  14. setmetatable(newButton, methods);
  15. ButtonInstance.MouseButton1Down:Connect(function() Bind:Fire();end);
  16. return ButtonInstance;
  17. end;
  18.  
  19. function methods:Click()
  20. self._event:Fire();
  21. end;
  22.  
  23. return module;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement