Hi. I'm making a script which, if game.Workspace.Testing exists, It removes it. When trying to do this, An error comes up. This is the error:

07:37:08.680 - Testing is not a valid member of Workspace 07:37:08.682 - Script 'Workspace.GameScript', Line 1 07:37:08.683 - Stack End

This is the script:

if game.Workspace.Testing then
		game.Workspace.Testing:remove()
	else
		if game.Workspace["Testing 2"] then
		game.Workspace["Testing 2"]:remove()
	end
	end

I have no clue how to fix it. Any help is appreciated, Thanks!

2 comments

0

This error means that the asset "Testing" doesn't exist in Workspace. Are you sure "Testing" exists in Workspace before the script starts?

0

It gets added in after the script starts