When you hover the background gets longer when you leave it gets smaller this is the error.
13:14:04.680 - Players.Player.PlayerGui.Gui.Frame.Frame.TextButton.Script:4: attempt to compare > > two userdata values 13:14:04.681 - Stack Begin 13:14:04.683 - Script 'Players.Player.PlayerGui.Gui.Frame.Frame.TextButton.Script', Line 4 13:14:04.684 - Stack End
And this is the code.
local background = script.Parent.Parent.Background function enter() while background.Size < UDim2.new(0,250,0,50) do wait(.5) local bgd = background.Size + UDim2.new(0,10,0,0) end end function leave() while background.Size > UDim2.new(0,0,0,50) do wait(.5) local bgs = background.Size - UDim2.new(0,10,0,0) background.Size = bgs end end script.Parent.MouseEnter:connect(enter) script.Parent.MouseLeave(leave)
Thanks for the help.
As obcdino said, you cannot compare a GUI size and a UDim2 value.'
You can simplify your code with a TweenSize. http://wiki.roblox.com/index.php?title=API:Class/GuiObject/TweenSize
Take out:
while background.Size > UDim2.new(0,0,0,50) do
and
local bgs = background.Size - UDim2.new(0,10,0,0)
and do Code:
background:TweenSize(UDim2.new(0,10,0,0),'Out','Quad',.5,true)
Just replace the UDim2 values with the new size of the GUI, and set the number to the number of seconds for it to take to tween.