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

How to check a TextLabel's position?

Asked by 8 years ago

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
Your second line, change UDim2 to UDim2.new Im_Kritz 334 — 8y

1 answer

Log in to vote
0
Answered by
lucas4114 607 Moderation Voter
8 years ago

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
Ad

Answer this question