I’m having a little of an issue with Alignpositions not syncing with each other
So basically it looks like this:
https://i.gyazo.com/58e58dc0e8a09e8d04f57944ff322f79.gif
As you can see the different parts don’t react at the same time for some reason. There might not be a way to fix this but just in case, I’m asking here.
I don’t know what to do here. Should I approach this in a whole different way?
Anyways my script is here if you have any ideas pls reply
function PetHandler.PlacePositionWelds(plr)
PetHandler.ClearPets(plr) -- destroy goals and make new goals
local amountOfPets = #plr.Character.Pets:GetChildren()
if amountOfPets > 0 then
local anglePerPet = 360/amountOfPets -- get the angle between pets based on amount of pets
for currentPetNumber,Pet in pairs(plr.Character.Pets:GetChildren()) do -- place a part on each pets goal part
local hypotenuse = 5 -- PetRadius
local currentAngle = anglePerPet * currentPetNumber
local add180 = 1
local angle1 = 180 - currentAngle
local angle2 = 90
local angle3 = 180 - (angle1 + angle2)
local X = (math.cos(math.rad(angle3)) * hypotenuse)
local Z = math.sin(math.rad(angle3)) * hypotenuse
local Y = 0
local petGoal = Instance.new("Part", plr.Character)
petGoal.Name = "petGoal"
petGoal.CanCollide = false
petGoal.Transparency = 1
-- petGoal.CanCollide = false
petGoal.CFrame = CFrame.new(plr.Character.PrimaryPart.Position + Vector3.new(X, Y, Z), plr.Character.PrimaryPart.Position)
local weld = Instance.new("WeldConstraint", petGoal)
weld.Part0 = petGoal
weld.Part1 = plr.Character.PrimaryPart -- lock part to the character
local attachment0 = Instance.new("Attachment", Pet.PrimaryPart)
local attachment1 = Instance.new("Attachment", petGoal)
local alignPos = Instance.new("AlignPosition", Pet.PrimaryPart)
alignPos.Attachment0 = attachment0
alignPos.Attachment1 = attachment1
alignPos.Responsiveness = 50
alignPos.MaxForce = 5000
local alignOrient = Instance.new("AlignOrientation", Pet.PrimaryPart)
alignOrient.Attachment0 = attachment0
alignOrient.Attachment1 = attachment1
alignOrient.Responsiveness = 25
Pet.PrimaryPart.Position = plr.Character.PrimaryPart.Position
end
end
end