Hello my fellows : P
I’m here to introduce the module which might help you in GUI field, especially tween one
Why should I use this module?
- In case you want to make an animation for a Frame or Textbutton, you have to use TweenService and add a bunch of things, but with this module, it will make your code much more clear.
Suppose, I want to make hover animation for all buttons, if I don’t use UI Module it will takes a lot of time to make the animation
overview:
all buttons Size have set to Scale
without module:
local TS = game:GetService("TweenService")
local duration = 0.1
local scale = 1.05
local tweenInfoHover = TweenInfo.new(duration, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local tweenInfoUnhover = TweenInfo.new(duration, Enum.EasingStyle.Quad, Enum.EasingDirection.In)
local ScreenGui = script.Parent
for _, button in ScreenGui:GetChildren() do
if button.ClassName ~= 'TextButton' then continue end
local originalSize = button.Size
local Hover = TS:Create(button,tweenInfoHover,{Size = UDim2.fromScale(originalSize.X.Scale * scale, originalSize.Y.Scale * scale)})
local Unhover = TS:Create(button,tweenInfoUnhover,{Size = originalSize})
button.MouseEnter:Connect(function()
Hover:Play()
end)
button.MouseLeave:Connect(function()
Unhover:Play()
end)
end
with module:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UI = require(ReplicatedStorage:WaitForChild("UI"))
local ScreenGui = script.Parent
local duration = 0.1
local style = 'Quad'
for _, button in ScreenGui:GetChildren() do
if button.ClassName ~= "TextButton" then continue end
local newUI = UI.new(button)
newUI
:Hover(function()
newUI:Rescale(1.05,duration,style)
end)
:UnHover(function()
newUI:Rescale(1,duration,style,'In')
end)
end
both of them work at the same thing. But according to the code I send above, the one with module is way less code than the first one.
Plus, when using hover event from the UI Module, it supports sound effect, all you gotta do is change the other audio from Sound Folder
Here’s the file:
UI.rbxm (11.7 KB)
Everything has explained in HowtoUse Folder to use the module
Here’s what I want to achieve in this post:
- make the module itself run faster (optimization)
- add more functions (ideas)
- get feedback from you (yes you)
DISCLAIMER:
all functions that using TweenService cannot stop tween while playing
the UI Module is still in early development (there might be some bugs)
Thank you!



