Cannot Destroy() Terrain

I have a loop to go through workspace to delete the bots after a round

if Bool == "Stop" then

		for i, v in pairs(workspace:GetChildren()) do
			if v.Name == "HardJumpBot" or "EasyJumpBot" then
				v:Destroy()
			end
		end
	else

	end

But it gives the error "Cannot Destroy() Terrain "

your condition in your if is wrong. you should do it like this:

if v.Name == "HardJumpBot" or v.Name == "EasyJumpBot" then
				v:Destroy()
			end

Also, because a string returns true as it contains something that’s why the if-condition is always true and other children of workspace is affected by it.

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