player = script.Parent.Parent
fix = script.Parent:clone()
while true do
wait(40)
script.Parent:remove()
fix.Parent = player
end
COMMUNITY QUESTION
Why does this simple code output an error. A fix and explanation would be preferred?
1 answer
From what you've given us and what I've been able to understand,
Considering is one script.
Whats happening:
player = script.Parent.Parent --script.parent.parent is player
fix = script.Parent:clone() --script.Parent was cloned
while true do -- you started a loop
wait(40) --waited 40 seconds
script.Parent:remove() -- removed the scripts parent.
fix.Parent = player -- tried to put the clone into script.parent.parent
end -- ended
When you remove the scripts parent, you remove the script and it is unable to continue after that. So, did this error, or not do what you expected?
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Can you tell us the error?
What is the error in your output?
Why are you doing this script?