Clone a model to player

I trying to clone a model for apply to player join the game, i have script this but it’s not work:

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
	local copy = workspace.Zombie
	copy:Clone().Parent = player.Character
	player:LoadCharacter()
	end)
end)

Someone have a solution ?

3 Likes

The character is reset when you call ‘player:LoadCharacter()’, un-doing the insertion of ‘copy’.

As @Blokav mentioned, ‘player:LoadCharacter()’ makes it so your character resets, cleaning out all of the Backpack. If I were you, I would make a script something like this:

game.Players.PlayerAdded:Connect(function(Player)
        player.CharacterAdded:Connect(function(Character)
                 local Copy = workspace.Zombie:Clone()
                 Copy.Parent = Character
        end)
end)

This script makes it almost similar to yours, but you could also add a Died event and cloning the Zombie again, as the Zombie from the player will disappear.

Thanks but not working :confused: a clone was created next to the model but not on me ^^

What are you trying to do here?

Are you trying to make the player spawn as a zombie?

Yes, i have a model in my workspace and i want to clone it for players join the server ^^

If you want a player to spawn as a custom character, you don’t clone the model to your character, instead, utilize StarterCharacter. Put your zombie model inside StarterPlayer, and name it StarterCharacter.

More info: StarterCharacter, StarterCharacterScripts & StarterHumanoid

Thank you for this :slight_smile: but i don’t have just one skin ^^ i want the player have a specific value spawn with specific model

Exemple:

On player join the game:
if money.Value >= 100 → spawn as a zombie
If money.Value >= 500 → spawn as knight

It is possible to make more than one skin with your system ?

1 Like

That is simple, you can just place a specific model for its respective specific cost.

replicatedStorage 
- Skin1
- Skin2
- Skin3

local RS = replicatedStorage

if money.Value >= 100 then Skin1.Parent = player.StarterCharacter

all this is pseudo ^ don’t expect it to work at it is

2 Likes

player.StarterCharacter does not exist ^^ i have already try to read this but we have player.Backpack and more other but player.StarterCharacter does not exist :slight_smile:

game:GetService(“StarterPlayer”) :slight_smile:

1 Like

I have make an other script with a part of yours and it’s work ^^ thank you for your help

You should mark @Ukendio 's answer as a solution if your problem is solved

Are you trying to make it so when a player dies, it creates an NPC which is a zombie version of them?

No, it’s supposed to make the player a zombie model if their money value isn’t > 500 or they’ll become a knight. This isn’t an NPC being spawned in upon death.

Sorry, I didn’t thoroughly understand what you were try do to. But yeah, add it in StarterPlayer as @Headstackk mentioned.

–Try this

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
	local copy = workspace.Zombie
	player.Character = copy:Clone()
	--player:LoadCharacter()
	end)
end)

In this case, you could use the HumanoidDescription system.

You can add HumanoidDescription instances to a Folder for the sake of organization, and have a server script apply the HumanoidDescription one should have when they spawn.

2 Likes

I imagine you want the player to look like a zombie, so there are a few ways you could go about this.

Method 1
Create a new account on Roblox and make its avatar look how you want the zombie to look. Get the account’s ID and save it.

Then make it so that when the player is added, set the player’s Character to load to that ID.

Method 2

local Zombie = game.Workspace.Zombie

function LoadCharacter(Character)
    Character.Shirt.ShirtTemplate = Zombie.Shirt.ShirtTemplate
    Character.BodyColors:Destroy()
    Zombie.BodyColors:Clone().Parent = Character
    Character.Pants.PantsTemplate = Zombie.Pants.PantTemplate
    Character.Head.face.Texture = Zombie.Head.face.Texture
end

game.Players.PlayerAdded:Connect(function(plr)
       plr.CharacterAdded:Connect(LoadCharacter)
end)

Method 3
Using a HumanoidDescription and applying it to the player’s character on load.

3 Likes