For my medieval fantasy game, I made a starter GUI that allows players to customize a character model within a viewport frame; all edits done to this model are done locally via local scripts in the GUI. How would I begin having that character model replace players' standard character, essentially being a morph GUI?

I've taken multiple different approaches yet none of them have been successful, therefore, I'm holding off on posting my all script attempts so I don't cause unnecessary confusion.

If any additional clarification is needed, please don't hesitate to ask me. All help is appreciated!

Note: I don't think my issue will be fixed with error-fixing, I think my issue will be fixed by better understanding how I could make a morph GUI conceptionally. Still, here was my best attempt for reference:

Local script located within the GUI in starter GUI:

local Players = game:GetService("Players")
local player = Players.LocalPlayer or Players:GetPropertyChangedSignal("LocalPlayer"):wait()
local button = script.Parent
local classModelSelect = game.ReplicatedStorage.RemoteEvents.CModelSelect

button.MouseButton1Click:Connect(function()
	local finishedCharacter = script.Parent.Parent.Parent.Parent.CharacterCreator.MainFrame.CharacterViewer.Character:Clone()
	--Accessing the model within the viewport frame
	finishedCharacter.Parent = game.Workspace
	script.Parent.Parent.Parent.Parent.Enabled = false

	local CurrentCharacter = player.Character
	local LocalScripts = {}

	for index2,item2 in pairs(game.StarterPlayer.StarterCharacterScripts:GetChildren()) do
		if item2:IsA('LocalScript') then
			table.insert(LocalScripts,item2:Clone())
		else
			item2:Clone().Parent = finishedCharacter
		end
	end

	CurrentCharacter.Health:Clone().Parent = finishedCharacter
	table.insert(LocalScripts,CurrentCharacter.Animate:Clone())    
	finishedCharacter.Parent = workspace
	player.Character = finishedCharacter
	for index2,item2 in pairs(LocalScripts) do
		item2.Parent = finishedCharacter
	end

	classModelSelect:FireServer(finishedCharacter)

	local Connection

	local function onDied()
		wait(game.Players.RespawnTime)
		player:LoadCharacter()
		script.Parent.Parent.Parent.Parent.Enabled = true
		if Connection then
			Connection:Disconnect()
		end
	end

	Connection = finishedCharacter.Humanoid.Died:Connect(onDied)
end

Normal script located in server script service:

local classModelSelect = game.ReplicatedStorage.RemoteEvents.CModelSelect
classModelSelect.OnServerEvent:Connect(function(player, finishedCharacter)
	local outfit = finishedCharacter
	local Pos = player.Character:GetPrimaryPartCFrame()
	player.Character:Destroy()
	player.Character = finishedCharacter
	finishedCharacter:SetPrimaryPartCFrame(Pos)
end)

1 comment

0

Try to understand how the classic Morph Magic model works and make a similar gui.