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

Proper way to use this array?

I want to have this check if the name of the item is not Hat, and if it is, then it will end but if it isn't it will continue (I plan on adding more names to the array)

safe = {Hat}
if b.className=="Hat" and not b.name==#safe then
            b:Destroy()
end
end

THANKS!!!

1 comment

1

.. sigh. You did it again with "safe = {Hat}"

1 answer

✓ Accepted answer
keepHats={"name","name"}
do
	local keepHat=false
	for _,v in next,keepHats do
		if v==b.Name then
			keepHat=true
		end
	end
	if keepHat==false then
		b:Destroy()
	end 
end 

2 comments

0

Thx, and srry if im annoying you with me being a noob.

0

im getting an error: 23:56:14.220 - ServerScriptService.HatRemover:7: attempt to index global 'b' (a nil value)

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