Tween Module For Hovering Over Gui Objects

i spent the last 1-2 days making a quick module script for tweening gui objects when hovering with the mouse to excel my scripting skills. the module tweens every gui object u have in a ScreenGui. i hope this module saves time for u guys when scripting hovering animations!! :slight_smile:

  • u can add a sound on hover or leave it as nil if you don’t want one.

the module has 3 functions.

  1. :Tween()
  • you can animate the gui object with multiple properties.
  1. :Rotate()
  • rotates the gui object by the desired amount u give it.
  1. :Scale()
  • scale the gui object to expand or shrink it.
parameters for each function:

:Tween()

gui = ScreenGui,
tweenDuration = number,
easingStyle = Enum.EasingStyle,
easingDirection = Enum.EasingDirection,
repeatCount = number,
reverses = boolean,
delayTime = number,
tweenProperties = {} (a list of desired properties u wish to tween)
sound = Sound Instance

:Rotate()

gui = ScreenGui,
tweenDuration = number,
easingStyle = Enum.EasingStyle,
easingDirection = Enum.EasingDirection,
repeatCount = number,
reverses = boolean,
delayTime = number,
RotateAmount = number (the rotation u want the gui object to be)
sound = Sound Instance

:Scale()

gui = ScreenGui,
tweenDuration = number,
easingStyle = Enum.EasingStyle,
easingDirection = Enum.EasingDirection,
repeatCount = number,
reverses = boolean,
delayTime = number,
ScalePercentage = number (The percentage by which the GUI object expands or shrinks.),
sound = Sound Instance

code samples:

:Tween()

local guiTweenModule = require(game.ReplicatedStorage:FindFirstChild("guiTweenModule"))
local soundService = game:GetService("SoundService")
local hoverSound = soundService.hover
local gui = script.Parent

local tweenProperties = {
	Rotation = 8,
	Size = UDim2.fromScale(0.16, 0.16),
	BackgroundColor3 = Color3.new(1, 1, 1),
}

guiTweenModule:Tween(gui, 0.75, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut, 0, false, 0, tweenProperties, hoverSound)

33bf1f8c7d9501b493e36eee56f9ce7e

:Rotate()

local guiTweenModule = require(game.ReplicatedStorage:FindFirstChild("guiTweenModule"))
local soundService = game:GetService("SoundService")
local hoverSound = soundService.hover
local gui = script.Parent

guiTweenModule:Rotate(gui, 0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, nil, nil, 0.25, 90, hoverSound)

ae8e1d54f26231109c483ddcd8f768b9

:Scale()

local guiTweenModule = require(game.ReplicatedStorage:FindFirstChild("guiTweenModule"))
local soundService = game:GetService("SoundService")
local hoverSound = soundService.hover
local gui = script.Parent

guiTweenModule:Scale(gui, 0.35, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out, 1, nil, nil, -15, nil)

1ee27a45e830ebd4cae4122f89470583

module script (roblox) :

module script (file) :
guiHoverTweenModule.rbxm (2.8 KB)


the gui + script i used for demonstrations:

5 Likes