A friend and I are trying to make a pet system. Currently when I try to put the position of one pet to the position of another pet(minus a vector3 value), they tween away from the humanoid. Any tips 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()
table.insert(petPosition, clonedPet)
local chosenPet = petPosition[#petPosition]
clonedPet.Parent = workspace
while wait() do
if #petPosition == 1 then
local petTween = TweenService:Create(clonedPet, TweenInfo.new(0.1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {Position = plr.Character.HumanoidRootPart.Position - Vector3.new(-5, -1.5, 0)})
petTween:Play()
else
clonedPet.Position = chosenPet.Position - Vector3.new(-5, 0, 0,)
end
end
else
print("Entered text does not match any pets")
end
end
end)