Hello! So, I have a local script in StarterGui which controls the pet’s movements. And I wanted to make the pets faster, and was wondering how I can add Align Position to it. Any help is appreciated! Thanks!
local maxAngle = 120
game:GetService("RunService").Heartbeat:Connect(function()
if char and char.Humanoid.Health > 0 then
local numPets = #char["EQUIPPED PETS"]:GetChildren()
local degreesIncrement = maxAngle / (numPets-1)
for petNum, pet in pairs(char["EQUIPPED PETS"]:GetChildren()) do
local deg = (petNum-1)*degreesIncrement - 90 + (180-maxAngle)/2
if numPets == 1 then
deg = 0
end
local goalCF = char:FindFirstChild("UpperTorso") and char.UpperTorso.CFrame or char:FindFirstChild("Torso") and char.Torso.CFrame or char.HumanoidRootPart.CFrame
goalCF = goalCF * CFrame.Angles(0, math.rad(deg), 0)
goalCF = (goalCF - goalCF.LookVector * 6)
goalCF = goalCF * CFrame.Angles(0, -math.rad(deg), 0)
pet.PrimaryPart.AlignPosition.Position = goalCF.Position
pet.PrimaryPart.AlignOrientation.CFrame = goalCF
end
end
end)