I just want to know what to do to make this actually move, I've pointed out where my confusion is.
1 | while true do |
2 | wait( 1 ) |
3 | Value = math.random( 100 , 500 ) |
4 | if script.Parent.Parent.Tool.Enabled = = true then |
5 | script.Parent.Position = (Value,Value) --Not sure how to format this |
6 | end |
7 | end |
Edit
1 | while true do |
2 | wait( 1 ) |
3 | Value = math.random( 100 , 500 ) |
4 | if script.Parent.Parent.Tool.Enabled = = true then |
5 | script.Parent.Position = UDim 2. new( 0 ,Value, 0 ,Value) |
6 | end |
7 | end |
ANY Help is appreciated! Thanks!
UDim2's are the way GUI's position themself on-screen. They take scales and offsets. Scales are values from 0 to 1 while offsets can be anything as it gets the actual pixel distance. Don't do what chill did and make the scale over 1, otherwise the GUI won't even be on the screen.
1 | while wait( 1 ) |
2 | Value = math.random( 100 , 500 ) |
3 | if script.Parent.Parent.Tool.Enabled = = true then |
4 | script.Parent.Position = UDim 2. new( 0 ,Value, 0 ,Value) |
5 | end |
6 | end |
You should use the UDim2 keyword, Just Like CFrame is used for moving Parts UDim2 is used for moving GUI's
1 | script.Parent.Position = UDim 2. new (Value, Value, Value, Value) -- Since there are 4 values in The Gui you have to input 4 values |