Set cloned part orientation to original parts

https://gyazo.com/b9c58b2ca717b5694553d45ea79167fd
i tried to use weld but that didnt work

local ignorelist = {"HitBox","HitBox2","HumanoidRootPart","Head"}
local Debris = game:GetService("Debris")
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(
	3, 							-- Lenght (seconds)
	Enum.EasingStyle.Sine, 		-- EasingStyle
	Enum.EasingDirection.InOut, -- EasingDirection
	0, 							-- RepeatCount (when less than zero the tween will loop indefinitely)
	false, 						-- Reverses (tween will reverse once reaching it's goal)
	0 							-- DelayTime
)

local module = {}

function module.Hit(character,color,duration)
	local OverlayParts = Instance.new("Folder")
	OverlayParts.Name = "OverlayParts"
	OverlayParts.Parent = character
	
		for i,v in pairs(character:GetChildren()) do
		if v:IsA("Part") or v:IsA("MeshPart") then
			if v:FindFirstChild("OriginalSize") then
					if not table.find(ignorelist,v.Name) then
						local weld = Instance.new("WeldConstraint")

						local clonedpart = Instance.new("Part")
						clonedpart.Name = v.Name
						clonedpart.Material = Enum.Material.SmoothPlastic
						clonedpart.Size = v.Size * 1.06
						clonedpart.Position = v.Position
						clonedpart.BrickColor = BrickColor.new(1,1,1)
						clonedpart.CanCollide = false
						clonedpart.Transparency = 0.5

						weld.Part0 = clonedpart
						weld.Part1 = v

						clonedpart.Parent = OverlayParts
						weld.Parent = OverlayParts
					end
				end
			end
		end
	
	for i,v in pairs(OverlayParts:GetChildren()) do
		if v:IsA("Part") or v:IsA("MeshPart") then
			local tween1 = TweenService:Create(v,tweenInfo,{Transparency = 1})
			tween1:Play()
		end
	end
	
	Debris:AddItem(OverlayParts,0.5) --overlay duration
end

Hi, I would suggest using a CFrame rather than position. Here is your code modified by me:

local Debris = game:GetService("Debris")
local TweenService = game:GetService("TweenService")

local module = {}


local ignorelist = {"HitBox","HitBox2","HumanoidRootPart","Head"}
local tweenInfo = TweenInfo.new(
	3, 							-- Lenght (seconds)
	Enum.EasingStyle.Sine, 		-- EasingStyle
	Enum.EasingDirection.InOut, -- EasingDirection
	0, 							-- RepeatCount (when less than zero the tween will loop indefinitely)
	false, 						-- Reverses (tween will reverse once reaching it's goal)
	0 							-- DelayTime
)


function module.Hit(character,color,duration)
	
	local OverlayParts = Instance.new("Folder")
	OverlayParts.Name = "OverlayParts"
	OverlayParts.Parent = character

	for i,v in pairs(character:GetChildren()) do
		
		if v:IsA("Part") or v:IsA("MeshPart") then
			
			if v:FindFirstChild("OriginalSize") then
				
				if not table.find(ignorelist,v.Name) then
					
					local weld = Instance.new("WeldConstraint")

					local clonedpart = Instance.new("Part")
					clonedpart.Name = v.Name
					clonedpart.Material = Enum.Material.SmoothPlastic
					clonedpart.Size = v.Size * 1.06
					clonedpart.CFrame = v.CFrame
					clonedpart.Color = color
					clonedpart.CanCollide = false
					clonedpart.Transparency = 0.5

					weld.Part0 = clonedpart
					weld.Part1 = v

					clonedpart.Parent = OverlayParts
					weld.Parent = OverlayParts
				end
			end
		end
	end

	for i,v in pairs(OverlayParts:GetChildren()) do
		if v:IsA("Part") or v:IsA("MeshPart") then
			local tween1 = TweenService:Create(v,tweenInfo,{Transparency = 1})
			tween1:Play()
		end
	end

	Debris:AddItem(OverlayParts,0.5) --overlay duration
end


return module
1 Like

Also, just tested and it should work fine.