Iam trying clone the character Rig, to make a custom armor with that rig
But dont working, as you can see the movent is so weird… that is the full code
--//Services
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local ServerStorage = game:GetService("ServerStorage")
local Players = game:GetService("Players")
--//Modules
local Casting = require(game:GetService("ServerStorage").Modules.CheckCastingSkill)
local CheckSkill = require(ServerStorage.Modules.CheckCanSkill)
local Shield = require(game:GetService("ServerStorage").Modules.Shields)
local LerpAP = require(game:GetService("ReplicatedStorage").Modules.LerpAPI)
local Effects = require(ServerStorage.Modules.Effects)
local Skills = require(script.Parent.Parent.Script.Skills)
local DamageManager = require(ServerStorage.Modules.DamageManager)
local Unstoppable = require(ServerStorage.GoodEffects.Unstoppable)
local Metrics = {
["LeftFoot"] = Vector3.new(-0.8999999999999915,-5.49,0),
["LeftHand"] = Vector3.new(-2.7,-1.9,0),
["LeftLowerArm"] = Vector3.new(-2.7,-0.8,0),
["LeftLowerLeg"] = Vector3.new(-0.9,-4.3,0),
["LeftUpperArm"] = Vector3.new(-2.7,0.3,0),
["LeftUpperLeg"] = Vector3.new(-0.9,-2.9,0),
["LowerTorso"] = Vector3.new(0,-1.8,0),
["RightFoot"] = Vector3.new(0.9000000000000057,-5.5,0),
["RightHand"] = Vector3.new(2.700000000000003,-1.9,0),
["RightLowerArm"] = Vector3.new(2.700000000000003,-0.8,0),
["RightLowerLeg"] = Vector3.new(0.9000000000000057,-4.3,0),
["RightUpperArm"] = Vector3.new(2.700000000000003,0.3,0),
["RightUpperLeg"] = Vector3.new(0.9000000000000057,-2.9,0),
["UpperTorso"] = Vector3.new(0,0,0),
["Head"] = Vector3.new(0,2.3,0)
}
local UltraS = {}
UltraS.__index = UltraS
function UltraS.New(player,T,D,slot,Stage,cd)
if Stage == 2 then
Casting.RemoveCast(player.UserId,0)
Skills.Cooldown(player,0,"UltraShield",slot)
else
local newUltra = {}
setmetatable(newUltra,UltraS)
newUltra.Name = "UltraShield"
newUltra.Stage = 1
newUltra.OldCharacter = Instance.new("Folder",ServerStorage)
newUltra.Slot = slot
newUltra.Player = player
newUltra.OldCharacter.Name = newUltra.Player.Name
newUltra.Model = ReplicatedStorage.Skills.Elemental.UltraShield.Meshes.Model:Clone()
newUltra.Model.Name = player.Name.." UltraShield"
newUltra.Model.Parent = workspace
newUltra.Cooldown = cd
return newUltra
end
end
function UltraS:GetVectorFromCFrame(cf)
local VectorC = Vector3.new(cf.X,cf.Y,cf.Z)
return VectorC
end
function UltraS:Build()
if self.Stage == 2 then
for i,v in pairs(self.Player.Character:GetChildren()) do
if v:IsA("MeshPart")then
if v.Name~='HumanoidRootPart' then
local Clone = v:Clone()
Clone:ClearAllChildren()
Clone.Parent = self.Model
Clone.Anchored = false
Clone.CanCollide = false
Clone.CastShadow = false
Clone.Transparency = 0.8
Clone.Material = Enum.Material.Neon
local Motor = Instance.new("Motor6D",self.Model)
--local Weld = Instance.new("Weld",self.Model)
Motor.Part0 = Clone
Motor.Part1 = v
--Weld.Part0 = Clone
--Weld.Part1 = v
Clone.Size = Clone.Size * Vector3.new(2.8,2.8,2.8)
Clone.Position = v.Position + Metrics[""..v.Name]
end
elseif v.Name == "Head" then
local Clone = v:Clone()
Clone:ClearAllChildren()
Clone.Parent = workspace
Clone.Anchored = false
Clone.CanCollide = false
Clone.CastShadow = false
Clone.Transparency = 0.8
Clone.Material = Enum.Material.Neon
local Weld = Instance.new("Weld",self.Model)
Weld.Part0 = Clone
Weld.Part1 = v
Clone.Size = Clone.Size * Vector3.new(2.8,2.8,2.8)
Clone.Position = v.Position + Metrics[""..v.Name]
end
end
self.Player.Character:WaitForChild("Humanoid").HipHeight = 8
elseif self.Stage == 0 then
end
end
function UltraS:CreateEffects()
if self.Stage == 1 then
self.Stage = 2
coroutine.wrap(function()
for i = 0, 1, 1/30 do
self.Player.Character:WaitForChild("HumanoidRootPart").CFrame = CFrame.new(LerpAP.Lerp(self:GetVectorFromCFrame(self.Player.Character:WaitForChild("HumanoidRootPart").CFrame),Vector3.new(self.Player.Character:WaitForChild("HumanoidRootPart").CFrame.X,self.Player.Character:WaitForChild("HumanoidRootPart").CFrame.Y + 8, self.Player.Character:WaitForChild("HumanoidRootPart").CFrame.Z),i))
RunService.Heartbeat:Wait()
end
end)()
self:Build()
elseif self.Stage == 2 then
self.Stage = 0
--self:Build()
end
end
function UltraS:CanFire()
if self.Stage == 1 then
self:CreateEffects()
elseif self.Stage == 2 then
self:CreateEffects()
end
end
return UltraS