I am making a player choose map gui and it just gives me an error on this script why?
while true do
wait(0.2)
if script.Parent.Parent.Name == "PlayerGUI" then
wait(5)
script.Parent:Destroy()
end
end
ERROR: choosemap=1 Players.Player1.PlayerGui.MapGUI.Script:3: attempt to index field 'Parent' (a nil value) Stack Begin Script 'Players.Player1.PlayerGui.MapGUI.Script', Line 3 Stack End

2 comments
probably it did it once, then when he wants to do it again(since that's the loops job), he can't find it. add a "break" between line 5 and 6, then try it.
Thakns it's working know