Morph GUI help R15

I want to make a Morph GUI where, you have the r15 morphs in server storage, and it would create buttons in a scrolling frame depending on how many morphs are in the serverstorage folder.
My question is how do I do this, I already tried before and it failed I just need to know when they press the button the morph into the morph!
My failing script:

local Players = game:GetService('Players')
local Morphs = game:GetService('ReplicatedStorage'):WaitForChild('Morphs')
local visible = false
local recol = ''
function morph(plr, part, location, model, test)


	if plr ~= nil then
		if test == 'Morph' then
			if plr:FindFirstChild('Morph') == nil then
				local Folder = Instance.new('Folder')
				Folder.Name = 'Morph'
				Folder.Parent = plr
			end
		elseif test == 'Coat' then
			if plr:FindFirstChild('Coat') == nil then
				local Folder = Instance.new('Folder')
				Folder.Name = 'Coat'
				Folder.Parent = plr
			end
		elseif test == 'Add' then
			if plr:FindFirstChild('Add') == nil then
				local Folder = Instance.new('Folder')
				Folder.Name = 'Add'
				Folder.Parent = plr
			end
		elseif test == 'Pauld' then	
			if plr:FindFirstChild('Pauld') == nil then
				local Folder = Instance.new('Folder')
				Folder.Name = 'Pauld'
				Folder.Parent = plr
			end
		end
		local Folder = (test == 'Morph' and plr:FindFirstChild('Morph')
			 or test == 'Coat' and plr:FindFirstChild('Coat')
			 or test == 'Add' and plr:FindFirstChild('Add')
			 or test == 'Pauld' and plr:FindFirstChild('Pauld'))
		if Folder:FindFirstChild(model) == nil then
			local g = location[model]:Clone()
			g.Parent = Folder
			for i, v in ipairs(g:GetChildren()) do
				if v:IsA("BasePart") then
					local W = Instance.new("Weld")
					W.Part0 = g.Middle
					W.Part1 = v
					local CJ = CFrame.new(g.Middle.Position)
					local C0 = g.Middle.CFrame:inverse() * CJ
					local C1 = v.CFrame:inverse() * CJ
					W.C0 = C0
					W.C1 = C1
					W.Parent = g.Middle
				end
				local Y = Instance.new("Weld")
				Y.Part0 = plr:FindFirstChild(part)
				Y.Part1 = g.Middle
				Y.C0 = CFrame.new(0, 0, 0)
				Y.Parent = Y.Part0
			end
			local h = g:GetChildren()
			for i = 1, # h do
				if h[i].className == "Part" or  h[i].className == "UnionOperation" or  h[i].className == "MeshPart" or  h[i].className == "WedgePart" then  
					h[i].Anchored = false
					h[i].CanCollide = false
				end
			end
		end
	end
end
local function RunThings(char,Model, test)
	pcall(function()
		if Model:findFirstChild("Head") then
			morph(char, 'Head', Model, "Head",test)
			--char.Head.face:remove()
			--char.Head.Transparency = 1
		end
		if Model:findFirstChild("UpperTorso") then
			morph(char, 'UpperTorso', Model, "UpperTorso",test)
		end
		if Model:findFirstChild("LowerTorso") then
			morph(char, 'LowerTorso', Model, "LowerTorso",test)
		end
		if Model:findFirstChild("LeftUpperArm") then
			morph(char, 'LeftUpperArm', Model, "LeftUpperArm",test)
		end
		if Model:findFirstChild("RightUpperArm") then
			morph(char, 'RightUpperArm', Model, "RightUpperArm",test)
		end
		if Model:findFirstChild("LeftLowerArm") then
			morph(char, 'LeftLowerArm', Model, "LeftLowerArm",test)
		end
		if Model:findFirstChild("RightLowerArm") then
			morph(char, 'RightLowerArm', Model, "RightLowerArm",test)
		end
		if Model:findFirstChild("LeftHand") then
			morph(char, 'LeftHand', Model, "LeftHand",test)
		end
		if Model:findFirstChild("RightHand") then
			morph(char, 'RightHand', Model, "RightHand",test)
		end
		if Model:findFirstChild("LeftUpperLeg") then
			morph(char, 'LeftUpperLeg', Model, "LeftUpperLeg",test)
		end
		if Model:findFirstChild("RightUpperLeg") then
			morph(char, 'RightUpperLeg', Model, "RightUpperLeg",test)
		end
		if Model:findFirstChild("LeftLowerLeg") then
			morph(char, 'LeftLowerLeg', Model, "LeftLowerLeg",test)
		end
		if Model:findFirstChild("RightLowerLeg") then
			morph(char, 'RightLowerLeg', Model, "RightLowerLeg",test)
		end
		if Model:findFirstChild("LeftFoot") then
			morph(char, 'LeftFoot', Model, "LeftFoot",test)
		end
		if Model:findFirstChild("RightFoot") then
			morph(char, 'RightFoot', Model, "RightFoot",test)
		end
	end)
end
--MorphUser(Player,"TFO","Heroes","Austin","Morph")
--MorphUser(Player,"Addons","Addons","Coat","Coat")
local function MorphUser(User,Morph,name)
local MorphRoot = Morphs:WaitForChild(Morph)					
	local Model = MorphRoot:Clone()
	local char = User.Character
	RunThings(char,Model,name)
end
local function Body(depth,height,width,Char)
	for _,v in pairs(Char.Humanoid:GetChildren()) do
		if v.ClassName == 'NumberValue' then
			if v.Name == 'BodyDepthScale' then
				v.Value = depth
			elseif v.Name == 'BodyHeightScale' then
				v.Value = height
			elseif v.Name == 'BodyWidthScale' then					
				v.Value = width
			end
		end
	end
end
local function Finale(Char)
	for i,v in pairs(Char:GetChildren()) do
		if v:IsA('Accessory') or v:IsA('Hat') then
			v:Destroy()
		end
	end
end
local function Finale0(Char)
	for i,v in pairs(Char:GetChildren()) do
		if v.ClassName == 'MeshPart' or v.ClassName == 'n/a' then
			v.Transparency = 1
			if v:FindFirstChild('n/a') then
			    v.face:remove()
			end
		end
	end
end
local function Finale1(Char)
	for i,v in pairs(Char:GetChildren()) do
		if v.ClassName == 'MeshPart' or v.ClassName == 'Part' then
			v.Transparency = 1
			if v:FindFirstChild('face') then
			    v.face:remove()
			end
		end
	end
end

local function Finale2(Char)
	for i,v in pairs(Char:GetChildren()) do
		if v.ClassName == 'MeshPart' or v.ClassName == 'Part' and v.Name ~= 'Head' or v.Name ~= 'LeftHand' or v.Name ~= 'RightHand' then
			v.Transparency = 1
		end
	end
end

local function Finale3(Char) --head = existant
	for i,v in pairs(Char:GetChildren()) do
		if v.Name ~= 'Head' and v:IsA('BasePart') then
			v.Transparency = 1
		elseif v:IsA('BasePart') then
			v.Transparency = 0
		end
	end
end

local function Head(head,Char)
    for _,v in pairs(Char.Humanoid:GetChildren()) do
        if v.ClassName == 'NumberValue' then
            if v.Name == 'HeadScale' then
                v.Value = head
            end
        end
    end
end


local Select_Con = Instance.new("RemoteEvent", game.Lighting)
Select_Con.Name = "Morph_Selection_Trigger"
Select_Con.OnServerEvent:connect(function(Plr, Type)
	ypcall(function()
		morph(Plr,Type)
		game.ReplicatedStorage.Morphs[morph]:clone().Parent = Plr.Character
	end)
end)
2 Likes

This is unclear, What do you mean by

What’s the goal in this?

Is it like where they themselves can give their player a package?

R15 Morphs, like a Strom Trooper etc.
Do you need a reference image?

Are they in ServerStorage or ReplicatedStorage? You say they’re in ServerStorage, but the script says they’re in ReplicatedStorage.

Yes, please.

30 character

Putting random stuff so it works.

Oh I forgot to change that, they’re were in Replicated at the time of testing but now I want to change it.

Morp
A morph like this is what I need to work!

Is there any support? What can I do to do this.

1 Like

Thanks! I think i got it working…though there were two bumps in the road with the code above.

  1. Line 45 should be:

if v:IsA(“MeshPart”) then

instead of:

if v:IsA(“BasePart”) then

or at least that’s what I needed for my morph parts.

  1. then on line 123

local MorphRoot = Morphs[Team][Class][The folder with the morph parts]:WaitForChild(name)

instead of

local MorphRoot = Morphs[Team][Class]:WaitForChild(name)

I think we needed to dig down one more level (if i did the setup correctly :)).

But thanks, I got it working!

Jon

1 Like