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

What is this error bad argument #2 (UDim expected, got number)?

Hello I am making a image box move on a part. I did use surface gui and made a script inside of the surfacegui. This my script

local block = script.Parent.Block
local xPos = block.Position.X
local yPos = block.Position.Y
while true do
	block.AnchorPoint = Vector2.new(xPos + 25, yPos)
	block.Position = UDim2.new(0, xPos + 25, 0, yPos)
end

and when I play this it will give me an error.

bad argument #2 (UDim expected, got number)

I did try to do udim and udim2 and added a anchorpoint position with vecter2 please help me. Thanks

1 comment

0

Yeah don't use position when moving a GUI it's only used when doing the instance.new() factor

1 answer

You need change that

block.AnchorPoint = UDim2.new(xPos + 25, yPos)

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