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 10 days 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 1879 — 9d
0
no errors, just doesn't do anything Gnossien 80 — 9d

1 answer

Log in to vote
0
Answered by 10 days 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 — 10d
Ad

Answer this question