Hi I am trying to make a hover effect module but there’s something inefficient about my module
That inefficient thing is the 2 parameters it requires. Is there a way to remove these 2 parameters?
--] Variables [--]
local TweenService = game:GetService("TweenService")
local HoverSound = script.hover
local EventEffects = {}
function EventEffects.HoverEffect(Button,MouseEnterSize:UDim2,MouseLeaveSize:UDim2)
--local Hover: RBXScriptConnection?
local isHovering = false
local Debounce = false
Button.MouseEnter:Connect(function()
isHovering = true
Button:TweenSize(MouseEnterSize, Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true)
if not Debounce then
Debounce = true
HoverSound:Play()
Debounce = false
end
end)
Button.MouseLeave:Connect(function()
isHovering = false
Button:TweenSize(MouseLeaveSize, Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true)
end)
end
--function EventEffects.DisconnectHover()
--end
return EventEffects