So I’m making a charactermesh remover script for my goofy ragdoll game, and I can’t see why it doesn’t work. Any obvious stupid mistakes I made?
Code:
local Players = game:GetService('Players')
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
repeat wait() until Character
local charChildren = Character:GetChildren()
for _, thing in pairs(charChildren) do
if thing:IsA("CharacterMesh") then
thing:Destroy()
warn('found CharacterMesh, name is '.. thing.Name) -- this doesnt print out either
end
end
end)
end)
Yes, this post is a duplicate, but the other post doesn’t say how they fixed it…
The hierarchy is the same as all standard R6 characters. The character mesh is just slapped into the character model, so that wouldn’t make any difference
It just says “Something tried to destroy CharacterMesh in IConsumeCheddar, current parent is nil”, or something along the lines of that. I haven’t bothered with the script in like, well, 10 days so I forgot the exact error.
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAppearanceLoaded:Connect(function(char)
for _, v in pairs(char:GetDescendants()) do
if v:IsA("CharacterMesh") then
v:Destroy()
end
end
end)
end)