I've recently just started to learn the basics of Lua, however when I run this script, the second function does not seem to work. The first works just fine and destroys when I touch it, but it does not move randomly, as I have tried to attempt in the second function.
Model = game.Workspace.Part
function destroy()
game.Workspace.Part:Destroy()
end
script.Parent.Touched:connect(destroy)
function move()
Model:MoveTo(math.random())
wait(2)
repeat until script.Parent.Touched
end
game.Players.PlayerAdded:connect(move)

1 comment
There's not a whole not right in your second function. I suggest you look up MoveTo on the wiki, as well as reviewing how events work and what repeat loops are used for.