Aligning Position

I want to make a part follow the player

I am like really bad with these attachments and 3d values etc

I somewhat doesn’t work and sometimes when the character jumps the part drops to the void.

			local Model 
			if Model then
			local att1 = Instance.new("Attachment")
				att1.Name = "Attachment1"
				att1.Position = PetModel:FindFirstChild("AttachmentPosition").Value
				att1.Parent = Player.Character.HumanoidRootPart
			local att0 = Instance.new("Attachment")
				att0.Name = "Attachment2"
				att0.Parent = Model.PrimaryPart
				
				local alingpos = Instance.new("AlignPosition")
				alingpos.Attachment0 = att0
				alingpos.Attachment1 = att1
				alingpos.RigidityEnabled = false
				alingpos.MaxForce = Model .MaxForce.Value
				alingpos.Responsiveness = Model.Responsiveness.Value
				alingpos.Parent = Model.PrimaryPart
				
				local alingorientation = Instance.new("AlignOrientation")
				alingorientation.Attachment0 = att0
				alingorientation.Attachment1 = att1
				alingorientation.RigidityEnabled = false
				alingorientation.MaxTorque = Model.MaxForce.Value
				alingorientation.Responsiveness = Model.Responsiveness.Value
				alingorientation.Parent = Model.PrimaryPart
				
				
				
				
				
			
			
			Model.Parent = workspace
				Model.PrimaryPart:SetNetworkOwner(Player)
				
				game:GetService("RunService").Heartbeat:Connect(function()
					
					
					att0.Position = Model.AttachmentPosition.Value
					alingpos.MaxForce = Model.MaxForce.Value
					alingorientation.MaxTorque = Model.MaxForce.Value
					alingpos.Responsiveness = Model.Responsiveness.Value
					alingorientation.Responsiveness = Model.Responsiveness.Value
					
					
				end)

the part should be next to or somewhere aound the player and not inside and acting like that

2 Likes

What is the end goal here? Is this for some kind of “pet” system? Should the part smoothly follow the player at a distance? Do you want the part to be literally locked-into the exact same position of the player’s root part?

Kind of something like that, I would like to learn attachments and I thought I could test around making some kind of a pet or block that smoothly follows the player.
So not directly locked , but I searched about the topic and found that if I used alingposition and rotation I would get the part to rotate where the player rotates and move where the player moves, but in a small distance

1 Like