Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Gui size increased when hovered [Gui Size Tween?]

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

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

2 comments

0

No errors, However the TextButton will not enlarge.

0

That is the tweenings problem. You probably tweened it wrong

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)

2 comments

0

Players.RealNoobBot.PlayerGui.ScreenGui.Frame.InvenB.Script:2: ')' expected near 'size'

1

Are you serious? You just copy the script and keep the "big size" and "small size" without changing them to Udim2 numbers?

This discussion is preserved as it was. New answers, comments, and votes are closed.