So, I want to make it like when you hover over a text button, it expands, if you leave it, it goes back to normal size. Here is a script I'm stuck with, Feel like it should work
here is a repro:
https://imgur.com/a/7iN4X -- Normal, I need to to go bigger when its hovered.
01 | Player = game.Players.LocalPlayer |
02 | Mouse = Player:GetMouse() |
03 |
04 |
05 | local InvenButton = game.StarterGui.ScreenGui.Frame.InvenB |
06 | local ShopButton = game.StarterGui.ScreenGui.Frame.ShopB |
07 | local BuyButton = game.StarterGui.ScreenGui.Frame.BuyB |
08 | local SettingsButton = game.StarterGui.ScreenGui.Frame.SettingB |
09 |
10 | InvenButton.Mouse:connect( function () |
11 | game.StarterGui.ScreenGui.Frame.InvenB:TweenSize(UDim 2. new( 0 , 88 , 0 , 80 )) |
12 | end ) |
Hey there, MouseEnter()
and MouseLeave
is what you are looking for. Here are some links you can look at
http://wiki.roblox.com/index.php?title=MouseEnter
http://wiki.roblox.com/index.php?title=MouseLeave
To use it, simply define the buttons and then run the function:
1 | local B = -- where B is |
2 |
3 | B.MouseEnter:Connect( function () |
4 | -- tween big |
5 | end ) |
6 |
7 | B.MouseLeave:Connect( function () |
8 | --tween small |
9 | end ) |
if this helped you in anyway, make sure to upvote and accept answer. If you have a error comment on the answer.
-- Your Orange, BlackOrange3343 -- PS: Good luck
1 | button.MouseEnter:connect( function () |
2 | button:TweenSize(Udim 2. new(big size), "Out" , "Quad" , 0.5 , true ) |
3 | end ) |
4 |
5 | button.MouseLeave:connect( function () |
6 | button:TweenSize(Udim 2. new(small size), "Out" , "Quad" , 0.5 , true ) |
7 | end ) |