How do i make parts fly and snap to my body

Alright, so i wanted to make an ironman suit system like on this video
Tze, iron man

but i don’t really know how to make the parts fly like that, i’ve tried alignposition and alignorientation but they were just too smooth. i want to make it snap

1 Like

A basic idea here, but…
Maybe you could use a combination of 2 Tweens?
Here’s a pipeline of what I mean:

When this is executed, the tweens are created, with their destination being about X studs before the player.
The Tween tweens the parts’ position using a InOut Direction Quad/Quint wave. (This makes them speed up off their start position, and slow down before reaching their destination a bit away from the player)

Then, on Tween.Completed, you can create another tween that tweens the position and rotation to the player’s body parts. You can use an Exponential Wave with an In Direction to make it speed up real fast, a Back Wave with an Out direction to make it look like it’s going a bit further away, and speeding onto the body, or an Elastic wave with an In Direction to just make it look like an elastic band. (But elastic would also make it bounce when it snaps on, so not very realistic)

Again, just some ideas you can use using tween. (Although, to note, this does mean the player should be anchored during the animation to make it look realistic!)

Hope that helps. c:

thanks but, i don’t really want to make the player anchoreed during it
also i’ve tried lerping now but it still has the same problem as the alignposition and alignorientation
which is that its too smooth

Did you attempt the lerping with an alpha based on delta time? From the video it seems like the parts are driven by a force. You can see them accelerating , lerping with delta time would scale based on distance, it doesn’t give an effect of force applied. AlignPosition should be able to this, but I find its variables hard to tune for a case like this. What I would do is have a set acceleration for parts , and change their CFrame based on this acceleration, should be simple physics. For rotation you can still depend on lerping, the alpha can be based on distance to target.

1 Like

i used a for loop, is that bad? also i don’t think i used any forces i only used lerping
here’s the script:

--Service
local UIS = game:GetService("UserInputService")
local SS = game:GetService("ServerStorage")
local REPS = game:GetService("ReplicatedStorage")

--Other Variables
local SuitsFolder = SS:WaitForChild("suits")

local suitOne = SuitsFolder.Suit

--Events
local events = REPS:WaitForChild("Events")


local callSuitEvent = events.CallSuit

local function sendSuit_player(player)
	local character = player.Character
	local cloneSuit = suitOne:Clone()
	print(character)

	cloneSuit.Parent = character

	for _,suitparts in pairs(cloneSuit:GetChildren()) do
		if suitparts:IsA("BasePart") then
			for _,bodyparts in pairs(character:GetChildren()) do
				task.spawn(function()
					if bodyparts:IsA("BasePart") then
						local cPart = bodyparts:FindFirstChild(suitparts.Name)
						print("hm")
						if cPart then
							for e = 0, 1, 0.01 do
								task.wait()
								suitparts.CanCollide = false
								suitparts.CFrame = suitparts.CFrame:Lerp(cPart.CFrame, e)
								suitparts.Anchored = true
								if e >= 0.5 then
									local weld = Instance.new("WeldConstraint", suitparts)
									weld.Part0 = suitparts
									weld.Part1 = bodyparts
									weld.Name = "Weld"
									suitparts.Anchored = false
									break
								end
								print(e)
							end
							print(suitparts.Name)
						end
					end
				end)
			end
		end
	end
end

local function sendExistingSuit_player(player)
	local character = player.Character
	local existingsuit = character.Suit

	for _,suitparts in pairs(existingsuit:GetChildren()) do
		if suitparts:IsA("BasePart") then
			task.spawn(function()
				for _,bodyparts in pairs(character:GetChildren()) do
					if bodyparts:IsA("BasePart") then
						local cPart = bodyparts:FindFirstChild(suitparts.Name)
						if cPart then
							for e = 0, 1, 0.01 do
								task.wait()
								suitparts.CanCollide = false
								suitparts.CFrame = suitparts.CFrame:Lerp(cPart.CFrame, e)
								suitparts.Anchored = true
								if e >= 0.5 then
									local weld = Instance.new("WeldConstraint", suitparts)
									weld.Part0 = suitparts
									weld.Part1 = bodyparts
									weld.Name = "Weld"
									suitparts.Anchored = false
									break
								end
								print(e)
							end
							print(suitparts.Name)
						end
					end
				end
			end)
		end
	end
end

local function destroySuit_player(player)
	local character = player.Character
	for _,bodyparts in pairs(character:GetChildren()) do
		if bodyparts:IsA("Model") and bodyparts.Name == suitOne.Name then
			for _, e in pairs(bodyparts:GetChildren()) do
				e.CanCollide = true
				e.Weld:destroy()
				for _,f in pairs(character:GetChildren()) do
					if f:IsA("Accessory") then
						f.Handle.Transparency = 0
					end
				end
			end
		end
	end
end

callSuitEvent.OnServerEvent:Connect(function(player, type)
	if type == "callsuit" then
		sendSuit_player(player)
		print("here it comes")
	elseif type == "destroysuit" then
		destroySuit_player(player)
		print("DESTROY!")
	elseif type == "callexistingsuit" then
		sendExistingSuit_player(player)
		print("wee")
	end
end)


If you don’t want it to be forced based sure this would work out, please atleast read what I have written before replying

right, sorry for my incompetence, i might have misunderstood your reply. for some reason i thought “the video” that you were referencing was my video that you replied to, im assuming that you were talking about the tze iron man video that i linked. im gonna try doing the set acceleration for parts method that u were talking about now

1 Like

use the same parts on the animation but with a fast remplacement

so like just set the suitparts to the bodyparts right before welding them?
alright