Pooglies
(Pooglies)
#1
So I have this script that gives glasses, but it also should remove the other things call glasses before, but it doesn’t work? any help?
local d = character:GetChildren()
for i=1, #d do
if (d[i].className == "Accessory") and (d.Name == "Glasses") then
d[i]:remove()
end
end
You should be using :Destroy()
, as remove is depreciated.
Your modified code:
local d = character:GetChildren()
for i=1, #d do
if (d[i].className == "Accessory") and (d.Name == "Glasses") then
d[i]:Destroy()
end
end
As a side note, you could use a for in pairs() loop to simplify the process:
for i, obj in pairs(character:GetChildren()) do
if obj.className=='Accessory' and
obj.Name=='Glasses' then
obj:Destroy()
end
end
Sorry for any formatting or typos, this post was composed on mobile
1 Like
Pooglies
(Pooglies)
#3
Alright, I will test this, hope it works, thank you!