Attempt to index nil after destroying part

Hello
I having issue with script, after destroy its still active and indexing nil with size

script.Parent.Warn:Play()
for i = 1,5 do
	for i = 1,3 do
		script.Parent.Size = script.Parent.Size + Vector3.new(2,2,2)
		wait()
	end
	for i = 1,3 do
		script.Parent.Size = script.Parent.Size - Vector3.new(2,2,2)
		wait()
	end
	wait()
        script.Parent:Destroy
end

You call Destroy on the first loop and then the loop continues. Did you mean to call it after the loop finishes?

Yeah, its just not the full script, i making it after the loop but still this problem

You destroyed the parent of the script, that means that all of it’s children will also be destroyed. So script.Parent will be nil.

Ig i got it how to fix that… Thanks(

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.