Im making a pet, wich is ONLY ONE CSG UNION, and has CanCollide property disabled, i inserted a script into it, but in a indeterminated moment, it stops following me. NOTE: THE UNION THAT IS THE PET, WHEN HAS CANCOLLIDE ENABLED, IT DOES NOT STOP FOLLOWING ME

this is the script that the pet has:

local pet = script.Parent

function givePet (player)
 if player then
  local character = player.Character
  if character then
   local humRootPart = character.HumanoidRootPart
   local newPet = pet:Clone ()
   newPet.Parent = character
   
   local bodyPos = Instance.new("BodyPosition", newPet)
   bodyPos.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
   
   local bodyGyro = Instance.new("BodyGyro", newPet)
   bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
   
   while wait() do
    bodyPos.Position = humRootPart.Position + Vector3.new(1, 1, 1)
    bodyGyro.CFrame = humRootPart.CFrame
   end
  end
 end
end

game.Players.PlayerAdded:Connect(function(player)
 player.CharacterAdded:Connect(function(char)
  givePet(player)
 end)
end)