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

How to check a TextLabel's position?

I have this chunk of code:

while wait() do
if script.Parent.Position == UDim2(0.5,-150,0.5,-100) then
	print("werked")
	script.Parent.Parent.Top.Visible = true
	script.Parent.Parent.Bottom.Visible = true
	for i = 1,20 do
		wait()
		print("running")
		script.Parent.Parent.Top.Img.ImageTransparency = script.Parent.Parent.Top.Img.ImageTransparency -.05
		script.Parent.Parent.Bottom.Img.ImageTransparency = script.Parent.Parent.Bottom.Img.ImageTransparency -.05
	end
end
end

It is meant to check if a certain frame is in a certain position, but I keep getting the error that UDim2 is not a 'table value'. Is there a certain way to do this, or can you not do this? Thanks. Also, please help my reputation, someone downvote spammed me D:

1 comment

1

Your second line, change UDim2 to UDim2.new

1 answer

You did UDim2 and should have done UDim2.new

while wait() do
if script.Parent.Position == UDim2.new(0.5,-150,0.5,-100) then
    print("werked")
    script.Parent.Parent.Top.Visible = true
    script.Parent.Parent.Bottom.Visible = true
    for i = 1,20 do
        wait()
        print("running")
        script.Parent.Parent.Top.Img.ImageTransparency = script.Parent.Parent.Top.Img.ImageTransparency -.05
        script.Parent.Parent.Bottom.Img.ImageTransparency = script.Parent.Parent.Bottom.Img.ImageTransparency -.05
    end
end
end

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