How can I make the ui work?

Hello developers, good evening, I have a small problem with a script that is made by polarisprog and I am trying to make it work but when I put the mouse the button disappears and I checked if it was wrong and I have not found anything

Videos:

robloxapp-20220127-2220597.wmv (357.0 KB)


ModuleScript:

local MOUSE_ENTER_SIZE = 1.1
local MOUSE_ENTER_DURATION = .2
local CLICK_SIZE = 1.2
local MOUSE_SIZE_DURATION = .2

local module = {}

local OriginalSizes = {}

local function On_Mouse_Enter(button, original_Size)
local HoverSize = UDim2.new(
original_Size.X.Scale/MOUSE_ENTER_SIZE,
0,
original_Size.Y.Scale/MOUSE_ENTER_SIZE,
0
)
button:TweenSize(HoverSize, “Out”, “Sine”, MOUSE_ENTER_DURATION, true)
end

local function On_Mouse_Leave(button, originalSize)

button:TweenSize(originalSize, "Out", "Sine", MOUSE_ENTER_DURATION, true)

end

local function On_Mouse_Click(button, originalSize)
local ClickSize = UDim2.new(
originalSize.X.Scale/CLICK_SIZE,
0,
originalSize.Y.Scale/CLICK_SIZE,
0
)
button:TweenSize(ClickSize, “Out”, “Sine”, MOUSE_SIZE_DURATION, true)
end

function module.SetUp(button)
if not table.find(OriginalSizes, button) then
OriginalSizes[button] = button.Size
end

local Main_Size = OriginalSizes[button]


button.MouseEnter:Connect(function()
	On_Mouse_Enter(button,Main_Size)
end)

button.MouseLeave:Connect(function()
	On_Mouse_Leave(button, Main_Size)
end)

button.MouseButton1Click:Connect(function()
	On_Mouse_Click(button, Main_Size)
end)

button.MouseButton1Up:Connect(function()
	On_Mouse_Leave(button, Main_Size)
end)

end

return module


LocalScript:

local ReplicatedStorage = game:GetService(‘ReplicatedStorage’)

local UI_Animation = require(ReplicatedStorage:WaitForChild(‘UI_Animation’))

for _, ui in ipairs(script.Parent:GetDescendants()) do

if ui:IsA(‘GuiButton’) then

UI_Animation.SetUp(ui)

end

end

ok finally i can fix it :grinning: :+1:

robloxapp-20220128-0013539.wmv (263.2 KB)