I've recently been trying to create a working morph GUI for a project I'm working on. So far, I've gotten it to display buttons with the appropriate faction names and outfits associated. However, I'm not sure how to get it to function and apply a selected morph onto a player.

Here's what I've gotten so far.


-- CONSTANTS --

local FactionsFrame = script.Parent.Parent.Factions local OutfitsFrame = script.Parent.Parent.Outfits local MorphsDIR = game.ReplicatedStorage.Morphs local Libs = game.ReplicatedStorage.Libs


-- MAIN --

for i, v in pairs (MorphsDIR:GetChildren()) do local Button = Instance.new("TextButton") Button.Size = UDim2.new(1,0,0,50) Button.BackgroundTransparency = 1 Button.Font = "Fantasy" Button.TextSize = 30 Button.TextXAlignment = "Left" Button.TextColor3 = Color3.fromRGB(255,255,255)

Button.Text = v.Name
Button.Parent = FactionsFrame

Button.MouseButton1Click:connect (function ()
	for i,v2  in pairs (OutfitsFrame:GetChildren ()) do
		if v2.ClassName == "TextButton" then
			v2:Destroy()
		end
	end
	for i, v3 in pairs (v:GetChildren()) do
		local Button2 = Instance.new("TextButton")
		Button2.Size = UDim2.new(1,0,0,50)
		Button2.BackgroundTransparency = 1
		Button2.Font = "Fantasy"
		Button2.TextSize = 30
		Button2.TextXAlignment = "Left"
		Button2.TextColor3 = Color3.fromRGB(255,255,255)
		
		Button2.Text = v3.Name
		Button2.Parent = OutfitsFrame
		
		Button2.MouseButton1Click:connect (function ()
			print(Button2.Text)
		end)
	end
end)

end