Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Trying to delete a model spawned from a script out of workspace, can someone give me a hand?

I tried different ways to delete a model from workspace but it wont work, here is the script that will not do anything. Anything will help like any roblox scripting support links I have not looked at.

function spawnmodel()
	for k,v in pairs(workspace:GetChildren()) do
		if string.find(v.Name:lower(), "TestModel") then
			v:Destroy()
		end
	end
end
script.Parent.MouseButton1Down:connect(spawnmodel)

1 answer

✓ Accepted answer
function spawnmodel()
	game.workspace[modelname]:Destroy()
end




script.parent.MouseButton1Down:Connect(spawnmodel)

I dont know exactly what you're looking for. Try this?

1 comment

0

I tried something similar to this but apparently the script you just gave me works, thank you.

This discussion is preserved as it was. New answers, comments, and votes are closed.