My goal is to remove CharacterMesh Instances that aren’t a certain MeshId in a ModuleScript.
The Code:
players.PlayerAdded:Connect(function(newb)
newb.CharacterAdded:Connect(function(weeb)
repeat wait() until weeb
for _, kid in pairs(weeb:GetChildren()) do
for _, allowedID in pairs(allowed) do
if kid:IsA("CharacterMesh") then
if kid.MeshId == allowedID then
print(kid.MeshId .. " | " .. allowedID)
else
warn(kid.MeshId)
end
end
end
end
end)
end)
The Issue
When I go to make sure the CharacterMesh.MeshId is not in the AllowedId Table so I can :Destroy() it still deletes the Allowed Meshes along with the Non-allowed ones.
The ModuleScript legit is just a table of Ids that i want allow for the game.