Skip to content

Instantly share code, notes, and snippets.

@Quenty
Created August 12, 2019 21:25
Show Gist options
  • Save Quenty/dff461a5ddfbb21bb5d6fd66c168259d to your computer and use it in GitHub Desktop.
Save Quenty/dff461a5ddfbb21bb5d6fd66c168259d to your computer and use it in GitHub Desktop.
BadConnectionCode.lua
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