I have a script where i want to delete all pets a player has. well, the pet models are staying in workspace they just aren’t following the player anymore. they’re still stored in the pets folder as well. not sure what to do with this.
module function
function module.DeleteAllPets(player)
if isServer then
table.clear(module.pets, table.find(module.pets, player))
local folder = workspace.Pets:FindFirstChild(player)
if folder ~= nil then
for _, v in pairs(folder:GetChildren()) do
if v:IsA('Model') then
v:Destroy()
end
end
end
else
return petInfoRemote:InvokeServer("DeleteAllPets", player)
end
end
local
deleteAllButton.MouseButton1Down:Connect(function()
for _, v in pairs(scrollingFrame:GetChildren()) do
if v:IsA("Frame") then
v:Destroy()
end
end
midFrame:ClearAllChildren()
PetModule.DeleteAllPets(game.Players.LocalPlayer)
end)