I’m trying to make a pet always go behind the player. In simulator games pets will always be behind the player even if they turn towards the pets. I’ve attempted some things but nothing has worked. Help would be appreciated!
local equipPetEvent = game.ReplicatedStorage.equipPet
local petPosition = {}
local TweenService = game:GetService("TweenService")
equipPetEvent.OnServerEvent:Connect(function(plr, nameOfPet)
for i, v in pairs(game.ServerStorage:GetChildren()) do
if v.Name == nameOfPet then
local clonedPet = v:Clone()
clonedPet.Parent = workspace
table.insert(petPosition, clonedPet)
local increment = #petPosition
while wait() do
local newPetTween = TweenService:Create(clonedPet, TweenInfo.new(0.1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {Position = plr.Character.HumanoidRootPart.Position - Vector3.new(-5 * increment, 0, 0)})
newPetTween:Play()
end
end
end
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.