So I made this script and put it into a gui button so that when it is clicked, a model from workspace is deleted. This works fine. However I also tried to make the script delete a tool from starterpack, but when I run the game and click the button, the script doesn't do anything. It no longer deletes the model from workspace nor does it delete a tool. here is the script.
wait(1)
script.Parent.MouseButton1Down:Connect(function()
script.Parent.Parent:Destroy()
game.StarterPack.M16:Destroy()
for i, model in pairs(game.Workspace:GetChildren())do
if string.match(model.name, "wasd")then
model:Destroy()
end
end
end)

6 comments
OH!!!
So I made a new script where I tried to remove it through the player's backpack. Nothing happened xd Can you show me what script you would make?
AAlright the answer will be updated in a few minutes
ok
Nothing happens. It's inside a local script that's inside a text button
Then I have no idea what the issue is it looks like it would work to me.