I've been building a game in which the player has to shoot an object through a device. The object in question gets cloned from a folder into the physical workspace. However, it can't execute code based on what its parent is, a vital part of the script.
I've simplified the script and put it below. Can you help me?
while true do
wait()
if script.Parent.Parent == game.Workspace then
script:Remove()
end
end

6 comments
So what is wrong with the above script? Is "script.Parent.Parent == game.Workspace" no returning true?
The script produces an error message on line 3 only when its true... I have no idea why.
Please post the entire script, since the simplified version appears to have no trouble? (Also, please, use Destroy instead)
Nvm, made it work by reloading the map
:Remove() has been deprecated.
Really? Because it still works...