Created
August 12, 2019 21:25
-
-
Save Quenty/dff461a5ddfbb21bb5d6fd66c168259d to your computer and use it in GitHub Desktop.
BadConnectionCode.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local MyClass = {} | |
MyClass.__index = MyClass | |
function MyClass.new() | |
local self = setmetatable({}, MyClass) | |
self._connection = nil | |
self._tooltip = nil | |
return self | |
end | |
function MyClass:ShowToolTip(tooltip) | |
if self._tooltip then | |
self._connection:Disconnect() | |
self._connection = nil | |
self._tooltip:Destroy() | |
self._tooltip = nil | |
end | |
self._tooltip = tooltip | |
self._connection = tooltip.Hidden:Connect(function() | |
self._connection:Disconnect() | |
self._connection = nil | |
self._tooltip:Destroy() | |
self._tooltip = nil | |
end) | |
end | |
function MyClass:Destroy() | |
if self._tooltip then | |
self._connection:Disconnect() | |
self._connection = nil | |
self._tooltip:Destroy() | |
self._tooltip = nil | |
end | |
end | |
return MyClass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment