Part not being renamed in function

So I’m working on a script which attaches a pet to the player using BodyPos and Gyro. When I test in studio with either Play Solo or a Local Server it works fine, the part is renamed and it follows the player but when I test in an actual live server joined via the game page the part floats above the player but does not follow them which it should. The pet is also not renamed to “Pet” so it retains it’s original name which stops the while loop.

I’ve tested with prints and in the server they do not print at all.

This is a screenshot from when I play on a live server.

This is when I test in studio.

This is the only code relating to the pet function and I have no idea what I’ve done wrong.
Note, I’ve put this into a pastebin as I couldn’t format it properly here

I’ve also tried calling the function when the character appearance has loaded using Player.CharacterAppearanceLoaded:Connect(function() but that still didn’t work.

I’ve probably done something really dumb. Any help is appreciated.

1 Like

Are you using a local script or a server script?

Server script!

Could this code be the problem?
while Character:FindFirstChild("Pet") do
Try adding this line of code before that repeat wait() until Character:FindFirstChild("Pet")

So it turns out I’m a very stupid idiot. Turns out I was publishing to the group place instead of my place (both have the same name).

1 Like

No one here is “stupid” or an “idiot”.
It’s just a small dumb mistake.
I can relate to your suffering


<3 <3