GUI box expanding on hover and music on click detection

Hello fellow robloxian. I’m trying to achieve a hover effect where the GUI expands when hovering over a gui. Something similar to the link below. Would prefer if someone knew where i can find a suitable tutorial as i was searching fourms and api for it.

What i want to achieve.
https://gyazo.com/1ee98f321fed94ef21f9822a69845ee1

Thanks!

2 Likes

What you’re looking for is TweenService. Very Simple to use, I’ll leave a link and code reference.

local "whatever you wanna tween a button or frame let's use button" = script.Parent

local TweenService = game:GetService("TweenService")
local Tweeninfo = TweenInfo.new(0.5,Enum.EasingStyle.Quad, Enum.EasingDirection.Out) -- can be whatever this just example
local Size = {Size = UDim2.New(0,0,0,0)-- edit this however
--now create the tween in order of
   -- what you want to tween,the tween info,the size
local enter = TweenService:Create(button,Tweeninfo,Size)

button.MouseEnter:Connect(function()
enter:Play()
end

You can tween colors too using tween service. Hope this helps.

Forgot to include mouse click sound. Just go to free models and search a mouse click sound, or upload your own. Insert it into replicatedstorage for example and write this

local sound = game.ReplicatedStorage.Sound -- add waitforchild if it gives error
local button = script.Parent
button.MouseButton1Down:Connect(function()
sound:Play()
end
5 Likes

I have a sound in ReplicatedStorage, it plays when I hit “play” button in the props menu which means the sound is OK,
but it does not play when the mouse is over the button. Print statement indicates that the mouseOver event is registered, but … I do not know what is wrong with the sound… Volume is OK, other sounds play, but not the one I chose… Any ideas how to fix it. Thanks.