I create a world for friends I created TextButton in ScreenGui I created some basic scripts in the button:
script.Parent.MouseButton1Click:Connect(function() --there should be a script here end)
the purpose of the button is that when you press it, it will clone, it will go to a random place on the screen. When you press the cloned button, the same thing will do.
i tried to do this but bugs kept popping up every time.(red dot)
Does anyone know what functions should I use here? I just know that there will be Clone () and Position functions?
If you have any questions then please comment them down below, the script already explains everything.
script.Parent.MouseButton1Click:Connect(function() -- Change script.Parent to the textbuttons location local newButtonClone = script.Parent:Clone() -- Clones the textbutton newButtonClone.Position = UDim2.new(math.random(), 0, math.random(), 0) -- Picks a random spot newButtonClone.Parent = script.Parent.Parent -- and then parents it to the screenGui end)