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

Whats wrong with this ImageLabel script?

Asked by 9 years ago

Line 3 has a error, but I dont know what it is. Please help.

function move()
    for i=1,50 do
    script.Parent.ImageLabel.Size + script.Parent.ImageLabel.Vector2.new (1,0)
    end


end
 script.Parent.MouseButton1Click:connect(move)

2 answers

Log in to vote
0
Answered by 9 years ago

Line 3, I'm assuming you want to do something with the sum of the values.

Right now, line 3 is like "Ok, I added 2 values, what do I do now?" Probably you just want the ImageLabel to equal the sum of those 2 values. And since it looks like you just want to add Vector2(1,0), you just use Vector2.new() You would do that like this:

script.Parent.ImageLabel.Size = Vector2.new(script.Parent.ImageLabel.Size.X + 1,  script.Parent.ImageLabel.Size.Y)
0
doesnt work, sorry. My_Comment 95 — 9y
0
Forgot this wasn't Unity, try the edited version. Octillerysnacker 115 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

Try this:

function MoveGui()
    for i = 1, 50 do
        script.Parent.ImageLabel.Size = script.Parent.ImageLabel.Size + UDim2.new(2, 0, 2, 0)
    end
end

-- Or

function MoveGui()
    script.Parent.ImageLabel:TweenSize(UDim2.new(2, 0, 2, 0), "Out", "Quad", 0.5, true)
end

-- Or

function MoveGui()
    script.Parent.ImageLabel.Size = UDim2.new(2, 0, 2, 0)
end

You would change what's inside of the UDim2.new() too what you would like the sizing to be. Play around with it a bit.

Answer this question