Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Gui size increased when hovered [Gui Size Tween?]

Asked by 6 years ago

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.

Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()


local InvenButton = game.StarterGui.ScreenGui.Frame.InvenB
local ShopButton = game.StarterGui.ScreenGui.Frame.ShopB
local BuyButton = game.StarterGui.ScreenGui.Frame.BuyB
local SettingsButton = game.StarterGui.ScreenGui.Frame.SettingB

InvenButton.Mouse:connect(function()
         game.StarterGui.ScreenGui.Frame.InvenB:TweenSize(UDim2.new(0, 88, 0, 80))
end)

2 answers

Log in to vote
1
Answered by 6 years ago

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:

local B = -- where B is

B.MouseEnter:Connect(function()
    -- tween big
end)

B.MouseLeave:Connect(function()
    --tween small
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

0
No errors, However the TextButton will not enlarge. RealNoobBot 18 — 6y
0
That is the tweenings problem. You probably tweened it wrong BlackOrange3343 2676 — 6y
Ad
Log in to vote
1
Answered by 6 years ago
button.MouseEnter:connect(function()
    button:TweenSize(Udim2.new(big size),"Out","Quad",0.5,true)
end)

button.MouseLeave:connect(function()
    button:TweenSize(Udim2.new(small size),"Out","Quad",0.5,true)
end)

0
Players.RealNoobBot.PlayerGui.ScreenGui.Frame.InvenB.Script:2: ')' expected near 'size' RealNoobBot 18 — 6y
1
Are you serious? You just copy the script and keep the "big size" and "small size" without changing them to Udim2 numbers? magicguy78942 238 — 6y

Answer this question