Hello, I have problem with script. When player will click on button, then it should remove all parts from model called "PartStorage", but don't work..

Script:

wait(0.1)
local click = script.Parent.ClickDetector
local storage = workspace.PartStorage:GetChildren()

function reset (player)
	if player.TeamColor == script.Parent.Parent.Parent.Parent.TeamColor.Value then
		for i = 1, #storage do
			if storage[i].className == "Part" then
				storage[i]:destroy()
				wait(5)
			end
		end
		end
	end

click.MouseClick:connect(reset)

4 comments

0

1st basic debugging is to add prints on each line till you find out where is stops e.g. print('a') print('b') ect. If the script reacehs the end then its a problem with the logic.

0

On line 9, isn't destroy suppose to be Destroy()? Maybe it doesn't matter, but a lot of the time it does. Just a comment =3

0

kingdom5 i'll do that. wfvj014 i tried with remove() and delete(), but only this one work in simple script to destroy one part.

0

Only removing one part and that's all ;/