So I have been working on a R15 morph for a star wars group. I have been having a problem in which parts of the morphs are oriented weird all at different angles.
Weld Function
local Players = game:GetService('Players')
local Morphs = game:GetService('ServerStorage'):WaitForChild('Morphs')
local Schemes = Morphs.Schemes
local recol = ''
local visible = false
local pack = true
local invis = false
local function MorphUser(User,Team,Class,Morph,name)
warn("name")
local MorphRoot = Morphs[Team][Class]:WaitForChild(Morph)
for _,v in pairs(User.Character:GetChildren()) do
if v.Name == name then
v:Destroy()
end
end
local UserMorph = MorphRoot:Clone()
UserMorph.Parent = User.Character
UserMorph.Name = name
if UserMorph:FindFirstChild('Shirt') then
if User.Character:FindFirstChild('Shirt') then
User.Character.Shirt:remove()
UserMorph.Shirt.Parent = User.Character
end
end
if UserMorph:FindFirstChild('Pants') then
if User.Character:FindFirstChild('Pants') then
User.Character.Pants:remove()
UserMorph.Pants.Parent = User.Character
end
end
for _,u in ipairs(UserMorph:GetChildren()) do
if u.Name ~= 'Shirt' and u.Name ~= 'Pants' then
--u.Middle.Transparency = 1
for _,p in ipairs(u:GetChildren()) do
if p:IsA("BasePart") then
local W = Instance.new("Weld",u.Middle)
W.Part0 = u.Middle
W.Part1 = p
local CJ = CFrame.new(u.Middle.Position)
local C0 = u.Middle.CFrame:inverse()*CJ
local C1 = p.CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
end
local Y = Instance.new("Weld",p)
Y.Part0 = User.Character:FindFirstChild(u.Name)
Y.Part1 = u.Middle
Y.C0 = CFrame.new(0, 0, 0)
p.CanCollide = false
p.Anchored = false
end
end
end
end
Thing that calls on the weld (This is not the entire thing but it should give you an idea)
--DEV TESTING--
elseif Player.Name == 'EMPTY' then
Morphs.Tools["SE-14C"]:Clone().Parent=Player.Backpack
Morphs.Tools["ISBDetain"]:Clone().Parent=Player.Backpack
Morphs.Tools["Smart Rocket"]:Clone().Parent=Player.Backpack
Morphs.Tools["E-22"]:Clone().Parent=Player.Backpack
MorphUser(Player,"TGE","Enforcement","Dev","Morph")
MorphUser(Player,"Addons","MorphAddons","Hat","Morph1")
Recolour(Character,"NavyGrey")
So a few things happen depending on the morph, it either.
A) doesn't load at all for no apparent reason (I checked output) B) things get flipped around https://gyazo.com/9bfde357a463ed295f8db89e7ac73081 C) it works fine
Any help is much appreciated.
