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

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

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.

1 comment

0

nope, i would say if n.Position == UDim2.new(0,28,0.0) then instead of then on a new line

1 answer

✓ Accepted answer

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)

2 comments

0

Thanks!

0

Np :P

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