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

How to make if then statements with UDim2.new position?

Asked by 7 years ago
Edited 7 years ago

A little weary of trying this on Studio, would this work?

local n = script.Parent

if n.Position == UDim2.new(0,28,0.0)
    then
n.Position = UDim2.new(0,-272,0,0) --The original Position

end  

--If a frame hits a certain position, then it should automatically revert to the original position the frame was set to.
0
nope, i would say if n.Position == UDim2.new(0,28,0.0) then instead of then on a new line greatneil80 2647 — 7y

1 answer

Log in to vote
0
Answered by
Simnico99 206 Moderation Voter
7 years ago
Edited 7 years ago

Yes it will work but you it will looks something like this:

local n = script.Parent

n.Position.Changed:connect(function() -- To trigger the function
  if n.Position == UDim2.new(0,28,0.0) then
    n.Position = UDim2.new(0,-272,0,0)
  end  
end)

0
Thanks! JoeRaptor 72 — 7y
0
Np :P Simnico99 206 — 7y
Ad

Answer this question