Creating followers

I know this is talked about alot on the Forums, but I’m looking for ways to create a Pet / Follower system. Almost ALL of the tutorials and discussions refer to pets that float and follow the Player - I’m looking to create a Pet system that follows and walks behind the Player.

In the link below you can see a method I had done using Humanoids etc. However, I’m looking to rely on AnimationControllers and have the Pet follow without the use a Humanoids :MoveTo() function.

I’ve seen games suches as:
ClubRoblox and Loomian Legacy that demonstrate the idea I’m referring to.

I am on mobile right now so cannot demonstrate physically.

My current method:
Followers have a Humanoid within them, their parts Ownership are set to the Player and the Followers :MoveTo() is managed via the client.

3 Likes

What I would do is to create a part welded to your character and with your pet object, put a bodyposition inside it and set the position to be the position of the part welded. You could create a simple loop for this so that the pet will always follow. If you don’t want it to float then make a hummanoid and just the objects the pet, and make it follow the welded part by :MoveTo()

2 Likes

My immediate thought was making a constraint with the pet and the player’s torso, but I’m not sure how that would work because I’m not a scripter.

2 Likes

I set the network owner to the player and then control all movement from a local script in starter gui via renderstepped function, it works good for me, have you tried this?

1 Like

This may be a good solution,but a very basic exploiter may size it to inf and clone it how many times he wants.

1 Like

That would not happen.

However @Instance0new solution would also not show the pets for everyone, only that player unless you fired an event to get the server to replicate it to all clients.

Any changes in a local script only affect that client thus if an exploiter changed the size to inf and cloned it would only affect them. If you are replicating it to the server then some simple sanity checks on the server would prevent this. This principle comes back to NEVER trust the client.

2 Likes

no, that will happen. The client with Network Ownership over a part will can do anything will it. And all clients and server can see it.

1 Like

No, network ownership only causes the physics calculations to be carried out on the device you set it to (the client in this case) so it looks smoother to the client because the results of the calculations do not have to be sent to the client.

Normally (and by default) the server has network ownership to prevent too many calculations being carried out on the client and creating unnecessary lag.

Here is the API for network Ownership

4 Likes

you can only set network owner from server so yeah it would show up because the way i do it is when a character gets added and data is loaded then all ur pets get cloned to a pets folder in workspace, then the client script sorts through that folder updating the pets position every frame.

1 Like

although the pets wont lag for you, if you have alot of pets, other peoples pets will lag for you, but not yours

2 Likes

If it is just the pets then no, it won’t lag, what I meant and I should have clarified more (bad me) is that you don’t set network ownership of everything to the client because then it will lag.

2 Likes

Oh yeah, i only set the pets network owner to the player, thats it.

1 Like

None of the responses have been appropriate or helpful in this situation.

Query still open

1 Like

There are AlignOrientation and AlignPosition constraints that might be of use if they float. If not those, you could just manually manipulate the CFrame of the pet.
If you want them to follow in a line, you could try using arrays to assign some sort of order to them so they do not run into each other. If you want them to float around you, try keeping them within a specific radius or offsetting them based on how many already are equipped.
If you want them to walk behind you, you can also keep track of the player’s position over time in a small array. That way the pets know where to walk as to not be lost. My old pet system made them hop to the next stud the player has walked on in the position array.

1 Like

Try using the pathfinding service.

If you set the HumanoidRootPart as the end point with an offset of a few studs on the x,z axis then it should work.

If you’re still unsure, this is a good place to start.

2 Likes

That may be an option.

This is how my follow system currently works:

    local Player = game:GetService("Players").LocalPlayer
	local Character = Player.Character
	
	local isPet = script:WaitForChild("isPet").Value
	local isMoving = Instance.new("BoolValue")
	
	local Distance = 5
	
	local WalkAnim = isPet["Humanoid"]:LoadAnimation(script["Animations"]["Walk"])
	
	isPet["Humanoid"].Running:connect(function(speed)
		if speed >= 5 then
			--WalkAnim:Play()
		else
			--WalkAnim:Stop()
		end
	end)
	
	game:GetService("RunService").RenderStepped:Connect(function(Step)
		if (isPet["HumanoidRootPart"].Position - Character["HumanoidRootPart"].Position).Magnitude > 50 then
			isPet:MoveTo(Character["HumanoidRootPart"].CFrame.p - Character["HumanoidRootPart"].CFrame.LookVector * Distance)
		end
		
		if (Character["HumanoidRootPart"].Velocity).Magnitude >= 0 then
			isPet["Humanoid"]:MoveTo(Character["HumanoidRootPart"].CFrame.p - Character["HumanoidRootPart"].CFrame.LookVector * Distance)
		end
	end)

Latest update.
https://gyazo.com/050cb4323fa398a3eee13f1e3f7663a3