Trying to make a part slowly follow another

trying to make a part slowly follow another cause I wanna make a character like rain world.

Im trying to get another part to follow torso so It is kinda like a snake

code btw:

local Character = script.Parent
local Humanoid = Character:FindFirstChildWhichIsA("Humanoid")
local Torso = Character:WaitForChild("Torso",3)
if Character.Name == "StarterCharacterScripts" then
	return
end

local TweenService = game:GetService("TweenService")

local Standing = false

local AlignPos = Instance.new("AlignPosition",Character.Torso)
AlignPos.Attachment1 = Humanoid.RootPart:FindFirstChildWhichIsA("Attachment")
AlignPos.Attachment0 = Torso:FindFirstChildWhichIsA("Attachment")
local BPOffset

Humanoid.Changed:Connect(function(changed)
	
end)


	


1 Like

Try this

local Character = script.Parent
local Humanoid = Character:FindFirstChildWhichIsA("Humanoid")
local Torso = Character:WaitForChild("Torso", 3)
if Character.Name == "StarterCharacterScripts" then
	return
end

local AlignPos = Instance.new("AlignPosition", Torso)
AlignPos.MaxForce = 1000  --how strong is the force? (if below 5 you may turn to the dark side and become a sith)
AlignPos.Responsiveness = 5  --higher = slower
AlignPos.Attachment1 = Humanoid.RootPart:FindFirstChildWhichIsA("Attachment")
AlignPos.Attachment0 = Torso:FindFirstChildWhichIsA("Attachment")

local BPOffset = Instance.new("BodyPosition", Torso)
BPOffset.MaxForce = Vector3.new(4000, 4000, 4000) --torso will lag behind if this aint ere
BPOffset.D = 10 --dampen 
BPOffset.P = 1000 --how strong are ye?

--update the position based on the humanoidrootpart's movement
game:GetService("RunService").Heartbeat:Connect(function()
	if Humanoid.MoveDirection.Magnitude > 0 then
		BPOffset.Position = Humanoid.RootPart.Position + Vector3.new(0, 3, 0)-- ya can adjust the offset for some smooth following
	end
end)
1 Like

never mind that one is fixed but how do I make another part follow it. like a snake?

1 Like

Using the lowest amount of code (none)

You could use ropeconstraints and other constraints

1 Like

problem with rope constraints is that there spin around the player

1 Like

You could use alignorientation and constraints

1 Like

I got something working here is character
image
the special mesh is set to sphere.

thanks for helping!

Could you mark me as the solution? I am trying to get my solutions up :3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.