Custom Character Morph System Issue

I want to create a system or rather a script that, when triggered by a ProximityPrompt interaction, replaces the player’s character with a cloned morph model.

The provided script doesn’t seem to work as intended. When the ProximityPrompt is triggered, the player’s character doesn’t switch to the cloned morph model

Video:

I have attempted to modify the original script to correctly handle the character switch and camera focus. I also incorporated error handling and added print statements to debug any potential issues. However, despite these efforts, the script still does not produce the desired results.

Here’s the current version of the script I’m using:

local model = script.Parent
local prompt = model.Prompt.ProximityPrompt

prompt.Triggered:Connect(function(player)
   local oldCharacter = player.Character
   local morphModel = model:FindFirstChildOfClass("Model")
   local newCharacter = morphModel:Clone()

   newCharacter.HumanoidRootPart.Anchored = false
   newCharacter:SetPrimaryPartCFrame(oldCharacter.PrimaryPart.CFrame)

   player.Character = newCharacter
   newCharacter.Parent = workspace
end)


If anyone has insights or suggestions on why this script might not be working as intended, or if there’s a more effective way to achieve the desired behavior, your help would be greatly appreciated!

I will show hierarchy and properties of my characters model on the chance the script is working correctly though the model may have insecurities.

Here is the hierarchy of the model, with the corresponding properties for the model itself, take note that all of the parts are unanchored, and can collide is true for each part and mesh below I will attach a photo of the humanoid properties. Though it may be hard to see, the PrimaryPart of the character is the HumanoidRootPart.

The following Image contains the properties for the Humanoid object.

Thanks

6 Likes

The script seems good. Can you go in more detail? What happens exactly? Are you sure it doesn’t switch?
Did you do a debug print for Player.Character?

Perhaps this video will better illustrate what’s happening.

As you can see the clone() does work I’m sure that the game recognizes newCharacter as my character with all the necessary information, my issue seems to be the character actually moving with me if that makes sense…

Even my animation handler with my custom animations work its just the fact that its like stuck in the ground or rather not following wherever I’m actually going. Its very weird… I can’t quite pinpoint the issue.

Using this script,

local model = script.Parent
local prompt = model.Prompt.ProximityPrompt

prompt.Triggered:Connect(function(player)
   print(player)
   local oldCharacter = player.Character
   local morphModel = model:FindFirstChildOfClass("Model")
   local newCharacter = morphModel:Clone()
   print(oldCharacter)
   
   newCharacter.HumanoidRootPart.Anchored = false
   newCharacter:SetPrimaryPartCFrame(oldCharacter.PrimaryPart.CFrame)
   print(newCharacter)
   player.Character = newCharacter
   newCharacter.Parent = workspace
end)

The output returns the following:

  18:21:17.135  bobmany1234  -  Server - MorphScript:5
  18:21:17.150  bobmany1234  -  Server - MorphScript:9
  18:21:17.151  BaconMonster  -  Server - MorphScript:13