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

Whats wrong with this ImageLabel script?

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

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)

2 comments

0

doesnt work, sorry.

0

Forgot this wasn't Unity, try the edited version.

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.

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