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

I need help with this script?

Asked by 8 years ago

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.

0
You cannot compare a GUI size and a UDim2 value. obcdino 113 — 8y
0
Look at me silly mistake mouseleave Bo2master01 0 — 7y

1 answer

Log in to vote
2
Answered by
Tigerism 220 Moderation Voter
8 years ago

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.

Ad

Answer this question