Hey there!
Basically I’m having a function that returns pet from Replicated Storage and adds all of it’s descendant parts to collision group which should not collide with players.
function returnPet(pet)
if petFolder:FindFirstChild(pet) then
local newPet = petFolder:FindFirstChild(pet):Clone()
for i,v in pairs(newPet:GetDescendants()) do
if v:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(v,"Pets")
end
end
return newPet
end
end
The issue I’m currently experiencing is that it literally works and doesnt’ work randomly.
Once I test it it works and then it doesnt. If I add print statement to check if anything is wrong it starts working and then stops working again.
Also this is my first post on dev forum, so corect me if I haven’t done something correctly.
Thank you!