I'm trying to make a script which when the brick is clicked it moves, although I don't know how to connect <while true do>
while true do script.Parent.Position = script.Parent.Position + Vector3.new(0,0,0.1) wait(0.1) end script.Parent.ClickDetector.mouseClick:connect()-- I don't know what to put here.
In the () I normally put the name of the function I need to call. But when I use a <while true do> how do I call the script?
Then I tried to do this
function move() script.Parent.Position = script.Parent.Position + Vector3.new(0,0,0.1) wait(0.1) end script.Parent.ClickDetector.mouseClick:connect(move)
But then it only moved once each time I clicked, but I'm not sure if you can put a while true do in a function?
Yes, you can place anything in a function
If the boot fits...
Functions are just, for beginners, a convenient way to get code from another part of the script to run when you want it. This can be from an event, or when you call it yourself somewhere else in your code.