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

Proper way to use this array?

Asked by 8 years ago

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
.. sigh. You did it again with "safe = {Hat}" Nickoakz 231 — 8y

1 answer

Log in to vote
0
Answered by
Nickoakz 231 Moderation Voter
8 years ago
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 
0
Thx, and srry if im annoying you with me being a noob. ghosteffectz 115 — 8y
0
im getting an error: 23:56:14.220 - ServerScriptService.HatRemover:7: attempt to index global 'b' (a nil value) ghosteffectz 115 — 8y
Ad

Answer this question