How do I use instance.new for GUI and make it spawn random?
Asked by
5 years ago Edited 5 years ago
I am making a Textbutton so it spawns atimaticaly and picks a random spot in the screen GUI. What do I do to make it go to a random position from
x = 0.021 - 0.953
y = 0.146 - 0.917
please help
This is my current code
1 | local xPos = math.random( 0.021 , 0.953 ) |
2 | local yPos = math.random( 0.146 , 0.917 ) |
4 | local Point = Instance.new( "TextButton" ) |
5 | Point.Parent = game.StarterGui.ScreenGui |
7 | Point.Size = script.Parent.TextButton 1. Size |
8 | Point.Position = UDim 2. new(xPos, yPos) |
It is a local script but the math.random position is not working