Can I switch morphs without destroying the player?

  1. What do you want to achieve?
    I want to stop my character select GUI from resetting when my players switch to a morph. It’s not super time sensitive but I’d like to fix this ASAP.

  2. What is the issue?
    Here’s my script, it fires a remoteEvent in replicatedStorage called ChangeChar.

local event = game.ReplicatedStorage.ChangeChar

event.OnServerEvent:Connect(function(player,model)
	local Char = model:Clone()
	local Pos = player.Character:GetPrimaryPartCFrame()
	player.Character:Destroy()
	player.Character = Char
	Char.Parent = workspace
	Char:SetPrimaryPartCFrame(Pos)
end)
  1. What solutions have you tried so far?

I tried removing the player.Character:Destroy() line. For whatever reason, the script still works? Except for the fact that it keeps resetting the GUI.

I’ve also tried messing around with the properties, I even disabled that one hidden (i think?) property called ResetPlayerGuiOnSpawn. I put the script for that in ServerScriptService and then in the button itself, with no luck.

It might be possible to get the children of the current model and make them invisible / disable collisions for the original player. This would make it so I don’t have to kill the original morph.

Here it is in action.

When I click on a character, my morph works, but the GUI goes back to how it was before. This wasn’t a problem until I wanted to add alternate skins for the characters. When I click on the morph name, it shows the “alternate skins” button for a moment before resetting itself.

Any help would be appreciated, thanks!

All you would have to do is set ResetOnSpawn to false in the GUI’s properties. With this on, the GUI will reset back to how it is in StarterGui, and when you change the player’s character respawns them. Turning this to false, will not reset back to the default look in StarterGui, instead, it will leave it how the player left it.

3 Likes

I tried that, BUT, you gave me the idea to instead have a button onscreen that opens the morph list! So players start as their avatar, THEN they can pick a morph.

My new issue is that when I try to enable the morph select GUI, nothing comes up.

Here’s the script I used in a separate button to open the morph select screen, and also the GUI’s properties.

script.Parent.MouseButton1Click:Connect(function()
	game.StarterGui.MainGUI.Enabled = true
end)

image

EDIT: I’m changing it, because ResetOnSpawn doesn’t work with my current loading system, since the GUI doesn’t come back when the player fully resets from the pause menu.

You must reference it within the Player’s GUI and not the server’s StarterGui.

PlayerObject.PlayerGui.MainGUI

3 Likes

OHHH… Thank you both! It works now <:]