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

I want to delete a certain string but everytime I load it says "eof expected near end?!

Ok so I have a certain code string and its saying that when I spawn to remove the accessory. I don't want that but when I delete that string and delete one end and try to load it says "eof expected near end"!

for _, v in pairs(char:GetChildren()) do
  if v.ClassName == "Accessory" then
    v:remove()
  end
end

2 comments

0

If that isn't your full script, then you most likely have an extra "end" somewhere.

0

You should use :Destroy(). Remove is deprecated.

1 answer

There's no problem with this script, might want to give us your full script instead.

Considering that you're looking for all Accessory and removing them, I'll guess that it'll be something like this.

game.Players.PlayerAdded:connect(function(player)
player.CharacterAppearanceLoaded:connect(function(character) -- do not use CharacterAdded, since all the character's accessory doesn't load without a delay, so use CharacterAppearanceLoaded
for i, v in pairs(character:GetChildren()) do
    if v:IsA("Accessory") then
       v:Destroy()
    end
end
end)
end)

1 comment

0

Ahh ok thanks.

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