This is my first time playing around with roblox phyics and I have no Idea why my pet is doing this.
Video:
https://gyazo.com/9ab7a3170a1901c22b064315f481b79e
Script:
local function equipPet(player,pet)
local character = player.Character
if pet ~= nil and character ~= nil then
if character:FindFirstChild(player.Name.."'s Pet") then
character[player.Name.."'s Pet"]:Destroy()
end
if character:FindFirstChild("attachmentCharacter") then
character:FindFirstChild("attachmentCharacter"):Destroy()
end
pet.Name = player.Name.."'s Pet"
pet:SetPrimaryPartCFrame(character.HumanoidRootPart.CFrame)
local modelSize = pet.PrimaryPart.Size
local attachmentCharacter = Instance.new("Attachment")
attachmentCharacter.Visible = false
attachmentCharacter.Name = "attachmentCharacter"
attachmentCharacter.Parent = character.HumanoidRootPart
attachmentCharacter.Position = Vector3.new(1,1,0) + modelSize
local attachmentPet = Instance.new("Attachment")
attachmentPet.Visible = false
attachmentPet.Parent = pet.PrimaryPart
local alignPosition = Instance.new("AlignPosition")
alignPosition.MaxForce = 2500
alignPosition.Attachment0 = attachmentPet
alignPosition.Attachment1 = attachmentCharacter
alignPosition.Responsiveness = 25
alignPosition.Parent = pet
local alignOrientation = Instance.new("AlignOrientation")
alignOrientation.MaxTorque = 25000
alignOrientation.Attachment0 = attachmentPet
alignOrientation.Attachment1 = attachmentCharacter
alignOrientation.Responsiveness = 25
alignOrientation.Parent = pet
pet.Parent = character
end
end
EDIT: I want it so it looks natural