Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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

Log in to vote
0
Answered by 5 years ago
function spawnmodel()
    game.workspace[modelname]:Destroy()
end




script.parent.MouseButton1Down:Connect(spawnmodel)

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

0
I tried something similar to this but apparently the script you just gave me works, thank you. NitrousGalaxy 9 — 5y
Ad

Answer this question