Hey there,
I am currently creating morphs for my group. I have the morphing all set up, but I am unaware of how to keep the morph from deleting once the player has died. So basically when the player has died and respawned, they should have the same morph still.
The script:
-- Server sided
game.Players.PlayerAdded:Connect(function(player)
player:GetPropertyChangedSignal("Team"):Connect(function()
if player.Team == game.Teams["Internal Agents"] then
wait(2)
morphManage:ApplyMorph(player, "InternalAgents")
for i, v in pairs(player.Character:GetChildren()) do
if v:IsA("Clothing") then
v:Destroy()
end
end
serverStore.Morphs.Clothing.IA.Shirt:Clone().Parent = player.Character
serverStore.Morphs.Clothing.IA.Pants:Clone().Parent = player.Character
end
end)
end)
Thank you for the help! 
1 Like
you can do this by adding a character added event and making a function to check when they spawn:
local function applyMorph(player)
if player.Team == game.Teams["Internal Agents"] then
wait(2)
morphManage:ApplyMorph(player, "InternalAgents")
for i, v in pairs(player.Character:GetChildren()) do
if v:IsA("Clothing") then
v:Destroy()
end
end
serverStore.Morphs.Clothing.IA.Shirt:Clone().Parent = player.Character
serverStore.Morphs.Clothing.IA.Pants:Clone().Parent = player.Character
end
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
applyMorph()
player:GetPropertyChangedSignal("Team"):Connect(function()
applyMorph()
end)
end)
end)
1 Like
Hey,
So i have been testing out this piece of code, then after a while, it started saying:
index nil with 'Team'
I have tried a few things to fix it such as making sure the player exists but I haven’t found anything that works.
Thank you! 
oh, sorry there was an error in script, this one will work:
local function applyMorph(player)
if player.Team == game.Teams["Internal Agents"] then
wait(2)
morphManage:ApplyMorph(player, "InternalAgents")
for i, v in pairs(player.Character:GetChildren()) do
if v:IsA("Clothing") then
v:Destroy()
end
end
serverStore.Morphs.Clothing.IA.Shirt:Clone().Parent = player.Character
serverStore.Morphs.Clothing.IA.Pants:Clone().Parent = player.Character
end
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
applyMorph(player)
player:GetPropertyChangedSignal("Team"):Connect(function()
applyMorph(player)
end)
end)
end)
2 Likes