Trying to keep my morph after death

Trying to keep my morph after death

I am new to scripting and I want to keep my morph after I die.

Here is the script that gives the player the morph when i click on a button in a gui.

  • game:GetService(“ReplicatedStorage”).ChangeChar.OnServerEvent:Connect(function(player, morphName)
  • local model = game:GetService("ReplicatedStorage").Morphs[morphName] --Find the morph in the folder*
    
  • local morph = model:Clone() --Clone it*
    
  • morph.Parent = workspace --Parent it to the workspace*
    
  • morph.HumanoidRootPart.CFrame = player.Character.HumanoidRootPart.CFrame --Set it's 
    
  •             position to the player's position*
    
  • morph.Name = player.Name --Name it the player name
    
  •         player.Character.player:remove() --Destroy the normal character> * 
    
  • wait()*
    
  • player.Character = morph --Set the morph to the character*
    
  • wait()*
    
  • game:GetService("ReplicatedStorage").ChangeChar:FireClient(player, morph) --Fire the change char event to the client with the morph	*
    
end)*

If you know a way to keep my morphed character after death please let me know!

thanks,

monky6021 :roblox:

1 Like

Hi fam, you can create a function that kicks in when the player dies to replace its morph quickly. Like this:

MyHumanoid.Died:Connect(function()
wait(2)
morph.Parent = workspace
morph.HumanoidRootPart.CFrame = player.Character.HumanoidRootPart.CFrame
morph.Name = player.Name
 player.Character.player:remove() 
player.Character = morph

end)
2 Likes

So I’m not going to write the script because I’m not able to right now, but an idea I have would be to:

  • Have a table filled with playernames and what morph they’re currently morphed as.
  • When the player dies, check the table and if they have a morph selected, they get morphed to their respected morph.

Also you might want to edit this and fix the script formatting. You added bullet points which makes this script insanely hard to read.

1 Like

Something like this should do it.

function Load()
	-- your script
end

player.Character.Humanoid.Died:Connect(function()
	player:LoadCharacter()
	Load()
end)
1 Like

Thanks for replying! If i try your code it gives me an error do you know how to fix it?

Well i tried it but it doesn’t let me respawn as my morph.

Nvm it’s fixed using this script:

game:GetService(“ReplicatedStorage”).ChangeChar.OnServerEvent:Connect(function(player, morphName)

  • player.Character.Humanoid.Died:Connect(function()*

  •   wait()*
    
  •   local model = game:GetService("ReplicatedStorage").Morphs[morphName] --Find the morph in the folder*
    
  •   local morph = model:Clone() --Clone it*
    
  •   morph.Parent = workspace --Parent it to the workspace*
    
  •   morph.HumanoidRootPart.CFrame = player.Character.HumanoidRootPart.CFrame --Set it's position to the player's position*
    
  •   morph.Name = player.Name --Name it the player name*
    
  •   wait()*
    
  •   player.Character = morph --Set the morph to the character*
    
  •   wait()*
    
  •   game:GetService("ReplicatedStorage").ChangeChar:FireClient(player, morph)*
    
  •   while true do*
    
  •   	wait(3)*
    
  •   	player.Character.Humanoid.Died:Connect(function()*
    
  •   	wait(5)*
    
  •   	local model = game:GetService("ReplicatedStorage").Morphs[morphName] --Find the morph in the folder*
    
  •   	local morph = model:Clone() --Clone it*
    
  •   	morph.Parent = workspace --Parent it to the workspace*
    
  •   	morph.HumanoidRootPart.CFrame = player.Character.HumanoidRootPart.CFrame --Set it's position to the player's position*
    
  •   	morph.Name = player.Name --Name it the player name*
    
  •   	wait()*
    
  •   	player.Character = morph --Set the morph to the character*
    
  •   	game:GetService("ReplicatedStorage").ChangeChar:FireClient(player, morph)*
    
  •   	wait(1)*
    
  •   end)*
    
  •   end*
    
  •   game:GetService("ReplicatedStorage").ChangeChar:FireClient(player, morph)*
    
  • end)*
    end)

2 Likes