Clone function only working once

I haven’t done lua in a while but decided to stretch my lua legs a little with a script using the clone function, which I’ve never actually used before.

It’s supposed to spawn a plane, and then remove said plane after three seconds. The thing is, it only works once and never again.

The script is below. Any ideas as to why it won’t repeat?

Thanks.

planeold = game.ServerStorage.Model
planenew = planeold:clone()
function onClicked()
	planenew.Parent = game.Workspace
	wait(3)
	planenew:Remove()


end
        script.Parent.ClickDetector.MouseClick:connect(onClicked)

Move the planenew variable inside the onClicked() function. That should fix the problem.

Thanks, this fixed it. I’m guessing the variable only repeats with the function when it itself is in the function?