New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

No clue why this simple hat remover script isn't working?

Asked by
sifterr 176
6 months ago

script in workspace


game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function(char) local des = char:GetDescendants() for i = 1, #des do if des[i]:IsA("Accessory") then des[i]:Remove() end end end) end)
0
Be more descriptive of how it doesn't work and script errors hiimgoodpack 2008 — 6mo
0
no errors, just doesn't do anything sifterr 176 — 6mo

1 answer

Log in to vote
0
Answered by 6 months ago

Use in pairs.


for i,v in pairs char:GetDescendants() do if v:IsA("Accessory") then v:Destroy() end end
0
function onTouched(hit) local d = hit.Parent:GetChildren() for i=1, #d do if (d[i].className == "Accessory") then d[i]:remove() end end end script.Parent.Touched:connect(onTouched) Brayden_V86 8 — 6mo
Ad

Answer this question