When I change the player.Character into a Custom Rigged model, their playerGUI and PlayerScripts dissappear

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make a morph system, to achieve it, I simply change the player’s character into a custom rigged model. However, when I do this, the player’s guis and scripts dissappear.

  2. What is the issue? Include screenshots / videos if possible!
    The morphed model–animations and everything-- work perfectly, however, when I actually change the player.Character into the model, the playerGui and playerScripts dissappear sometimes for some reason… (yes the morph is on the server)

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve looked up multiple solutions online, on the developer hub, scriptinghelpers, hiddendevs, but I haven’t found anything that helped me with my situation… Please help me.

Here’s some extra information that may help you find the issue.

This is the RIG i’m trying to morph into.
image

Here is my morph script on the server.

--local characterGui = game.ReplicatedStorage.Character

function ChangeBody(OldBody,NewBody)
	OldBody.Humanoid:RemoveAccessories()
	if OldBody.Head:FindFirstChild("face") then
		OldBody.Head.face:Destroy()
	end
	local BodyParts={'Head',['Chest']='Torso',['Arm1']='Left Arm',['Arm2']='Right Arm',['Leg1']='Left Leg',['Leg2']='Right Leg'}
	for i,v in pairs(BodyParts)do
		OldBody[v].Transparency=1
		if v~='Head'then
			local BodyPart=NewBody[i]:Clone()
			BodyPart.Parent=OldBody
			local Middle=BodyPart:FindFirstChild('Middle')
			for z,b in pairs(BodyPart:GetDescendants())do
				if b:IsA('BasePart')then
					b.CanCollide=false
					b.Anchored=false
					if b~=Middle then
						local W=Instance.new('Weld')
						W.Part0=Middle
						W.Part1=b
						local CJ=CFrame.new(Middle.Position)
						W.C0=Middle.CFrame:inverse()*CJ
						W.C1=b.CFrame:inverse()*CJ
						W.Parent=Middle
					end
				end
			end
			local W=Instance.new('Weld')
			W.Part0=OldBody[v]
			W.Part1=Middle
			W.C0=CFrame.new(0,0,0)
			W.Parent=W.Part0
		end
	end
end

function riggedMorph(plr, oldchar, morphchar)
	local newchar = morphchar:Clone()
	
	newchar.Name = plr.Name
	
	newchar:SetPrimaryPartCFrame(oldchar.PrimaryPart.CFrame)
	oldchar:Destroy()
	
	plr.Character = newchar

	newchar.Parent = workspace
end

function sendToSpawn(plr, hors)

	if hors == "Hero" then
		local Spawns = game.Workspace.Spawns:GetChildren()
		local char = plr.Character or plr.CharacterAdded:Wait()
		local RandomSpawn = Spawns[math.random(1, #Spawns)]
		char.HumanoidRootPart.CFrame = RandomSpawn.CFrame
		
		--CharacterGui:Clone().Parent = plr.PlayerGui
	elseif hors == "Slasher" then
		--CharacterGui:Clone().Parent = plr.PlayerGui
	end
end

game.ReplicatedStorage.Morph.OnServerEvent:Connect(function(plr, HORS, v)
	if game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name) then
		if game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name):FindFirstChild("Configuration") and game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name):FindFirstChild("Model") and game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name):FindFirstChild("Model"):FindFirstChildWhichIsA("Model") then
			print("morph")
			if plr.leaderstats.G.Value >= game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration.Gold.Value then
				plr.leaderstats.G.Value -= game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration.Gold.Value
				ChangeBody(plr.Character, game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Model:FindFirstChildWhichIsA("Model"))
				sendToSpawn(plr, HORS)
				plr.Character.Humanoid.WalkSpeed = game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration.Walkspeed.Value
				plr.Character.Humanoid.JumpPower = game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration.Jump.Value
				--characterGui:Clone().Parent = plr.PlayerGui
				if game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration:FindFirstChild("Weapons") then
					for i,v in pairs(game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration:FindFirstChild("Weapons"):GetChildren()) do
						if v:IsA("Tool") then
							wait(5)
							local weaponClone = v:Clone()
							weaponClone.Parent = plr.Backpack
						end
					end
				end
			end
		elseif game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name):FindFirstChild("Configuration") and game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name):FindFirstChild("RiggedModel"):FindFirstChildWhichIsA("Model") then
			print("riggedmorph")
			if plr.leaderstats.G.Value >= game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration.Gold.Value then
				plr.leaderstats.G.Value -= game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration.Gold.Value
				riggedMorph(plr, plr.Character, game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name):FindFirstChild("RiggedModel"):FindFirstChildWhichIsA("Model"))
				plr.Character.Humanoid.WalkSpeed = game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration.Walkspeed.Value
				plr.Character.Humanoid.JumpPower = game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration.Jump.Value
				--characterGui:Clone().Parent = plr.PlayerGui
				if game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration:FindFirstChild("Weapons") then
					for i,v in pairs(game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration:FindFirstChild("Weapons"):GetChildren()) do
						if v:IsA("Tool") then
							local weaponClone = v:Clone()
							weaponClone.Parent = plr.Backpack
						end
					end
				end
			end
		end	
	end
end)

if true then

elseif false then

end

I have different functions for folders called RiggedModel and folders just called Model, but both of them have this issue for some reason. On the client the Morph RemoteEvent is only called when a player clicks a button on the character selection gui. The folders it looks through are setup like this:

image

(both hero and slasher are the same)

The rig just looks like this generally
image

I use a plugin I made called UniqueRenamer (dont ask me why the number goes so high)
And yes I’m aware animations are supposed to be done on the client, I’m just testing some stuff right now.

Anyways, thats all the info you should know. Please help with this and thank you in advance.

(You can go ask for help on #help-and-feedback:scripting-support wothout prohibiting a script, please provide the morph script and the hierarchy of the rig)
Does it happen with other rigs?

Its a lil bit old post, probably OP already fixed it.
Yup, providing a code would be useful, but I think the issue is obvious. If OP is deleting the original character that is holding the Character scripts, and giving the player a new Rigged Model to be used as character, the scripts in StarterCharacterScripts folder wont be added automatically, cause the character is not respawning, the character simply got deleted and replaced with a new one.

Could be fixed by cloning the scripts and placing them in the new character model by script, or including the scripts in the new model in studio.

:thinking: hold on… the title says playerGui and PlayerScripts disappears… mmh…

I edited it to contain more info. Sorry about this.

I think your issue just stems from this part of the code. It’s important to make sure the player always has a character otherwise it is like killing them.

All you’d need to do is to set plr.Character to the new model and then delete the old one afterwards