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

How do I make my image gradually get smaller on the screen when it covers it?

Asked by 7 years ago

I'm trying to do a little animation to an image label that covers the screen and then gradually gets smaller until a certain size. The error is: X cannot be assigned to

local i = script.Parent.ImageLabel
function sizeX(a, b, c)
    for x = a, b, c do
        i.Size.X = Vector2.new({a, b, c}, 0)
    end
end

function sizeY(a, b, c)
    for y = a, b, c do
        i.Size.Y = Vector2.new({a, b, c}, 0)
    end
    wait(.001)
end

wait(3)
sizeX(1, .1, -.01)
sizeY(1, .2, -.01)
0
GUI's work with UDim2.new, I don't think they work with Vector2.new ? iDarkGames 483 — 7y
0
The only time Vector2.new() is used on a Gui is when it is used for any of these http://wiki.roblox.com/index.php?title=Vector2#Referenced_by M39a9am3R 3210 — 7y

1 answer

Log in to vote
0
Answered by
P100D 590 Moderation Voter
7 years ago

A Vector2 isn't usable with a GUI. GUIs use Udim2. To make a GUI get gradually smaller, you would use TweenSizeAndPosition instead of a for loop.

Ad

Answer this question