So,
Say I wanted to do a while true do
and put a onClick
function inside it, will it work?
Short answer, yes, but creating a function in a loop will just keep re-writing the previous function with the same function. There is no reason to do this. It will just consume resources with no functionality.
Depending on what you want to do, While true do repeats a loop until you tell it to stop, and onClick detects when you click an object, or Gui. If you wanted it to cause something to happen, you would do this
script.Parent.MouseButton1Click:connect(function() print("Text") -- this will print "Text" every time you click that object or gui end)
If this didn't answer your question, Hopefully someone else could help, But as far as I know, Putting a OnClick in a while loop isnt possible, But correct me if i'm wrong.