The client is unable to find the primarypart which isn’t allowing the pet’s movement to be shown. If I do the same exact thing on the server it works but the movement is choppy. If you are a new player this doesn’t happen but something breaks. (My guess leaving at a certain point breaks it.) The pet does exist but the client is unable to find it or the primary pet.
game:GetService("RunService").Stepped:Connect(function()
for _, pet in pairs(game:GetService("CollectionService"):GetTagged("PetModel")) do
local tag = pet:FindFirstChild"Owner"
if tag then
local plr = tag.Value
if plr and plr.Character and pet.PrimaryPart then
local offset = CFrame.new(3,2,0)
if plr.Character.Humanoid.Sit then
offset = CFrame.new(0,-1,-.5)
end
pet:SetPrimaryPartCFrame(pet.PrimaryPart.CFrame:Lerp(plr.Character.PrimaryPart.CFrame*offset, .1))
end
if pet.PrimaryPart == nil then
pet:Destroy()
end
end
end
end)
There are but they all have it, if a new player joins and buys a pet it will work fine but after some time, something breaks and I’m not sure what it is. Maybe it could be related to:
Are you using StreamingEnabled? One thing I’ve noticed is that when something is streamed out and then back in it won’t reset it’s primarypart. So it will be set on initial load but not once streamed in/out.
Honestly I think it’s a bug but I didn’t get around to posting a bug report for it yet. It only gets cleared on the client but obviously stays fine on the server. As a fix the only thing you can really do is find the child by name and reset it yourself. If the primarypart is always named the same thing then that should be trivial (but yes annoying and kinda hacky). Maybe I’ll go post that bug report now, haha
Well here’s the thing if your setting the CFrame on client- it’s not going to replicate to other players.
The Choppy movements will likely be the same on client, because network ownership is a bit irrelevant here. It depends more on your cframe implementation
This bug still exists for me. I have a model on the server whose PrimaryPart is set before parenting to the workspace. I am watching the folder it gets parented to for ChildAdded. When that fires I am then trying to get the PrimaryPart of that model and it prints nil while inspecting the properties both on servre and client shows it as being set properly.