How do I make a pet follow you?

So you have this system right now?

Not yet, I first want to make it so the pet follow’s you then I’m going to add the pet into the shop gui I made, I haven’t scripted anything but the leaderstats, and the shop opening and closing yet, when I have scripted the pet I’m going to attempt to script the buying and equipping system.

Assuming there’s no player we can make a variable called Player then in the future you can change the value of Player to the actual Owner.

Yes, that would be the thing I’m looking for.

So you would set the Player to yourself so the player is game.Players:WaitForChild(“YTFUZE123”) as you just want to test this system.

Yes, what would the rest of the script be and where would the script be? ServerScriptService? The pet right now is in serverstorage and has BodyGyro and BodyPosition in it.

Well you could put it in your pet model right now then think of module scripts later.

Alright, should I insert a Server Script?

Yes then the pet has its own script.

Okay, and what would I put in that script?

Define Player which i mentioned above if forgotten.

Sorry but do you mind sending me a script to put in? Sorry about this.

It’s fine

local Player = game.Players:WaitForChild(“YTFUZE123”)

Have you made an attempt? And if you’re a beginner I highly recommend you sharpen up your skills before making a pets system

You could add an attachment to the player’s HumanoidRootPart and then add an AlignPosition and AlignOrientation constrants to the pet so they follow the attachment on the player, which will replicate the effect of a pet following you.

Here is a tutorial by AlvinBlox. It will explain how you can use this method.

2 Likes

That is not how you get the Local player in a Local Script.
This is how:
local Player = game:GetService("Players").LocalPlayer

This is a serverscript Not a localscript.

Thank you, I couldn’t find the video’s before, I will watch them now, sorry for wasting you guys’ time, thank you for your help and have an amazing day! :slight_smile:

1 Like

No man, its all good!

I suggest viewing these playlists to learn more about scripting on Roblox.

Rocket propulsion is made just for that. It allows a wide variety of options, settings and features. It’s very compact and simple to learn too.
You could combine it with some mechanics and make a pet follow an object naturally.