Hi there! I’m currently trying to turn the player’s character into a custom one I made, though I am experiencing an issue. The player dies when I do it, then he goes back to normal (default roblox character).
This is the line of code causing the issue:
player.Character = customCharacter
I have tried searching, but can’t find any topics related to this that have a working solution.
function morphPlayer(player)
local model = game.ServerStorage.CustomMorph
local morph = model:Clone()
morph.Parent = workspace
morph:MoveTo(player.Character.UpperTorso.Position)
morph.Name = player.Name
player.Character = morph
return morph
end
Call this method whenever the player’s CharacterAdded event fires:
local PlayerService = game:GetService("Players")
local function OnPlayerAdded(player)
Player.CharacterAdded:Connect(function(character)
morphPlayer(player) -- This method will be called whenever the player's character is added example: respawning
end)
end
PlayerService.PlayerAdded:Connect(OnPlayerAdded)
I made a topic on this (and solved it) recently. Short version, Humanoid kills both characters when ownership changes. So you need to swap characters, then add Humanoid.