Goulstem's method crashes the server
Let's just say there's a model called Bob in the lighting and it has a armor welded to its torso.
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) local bob = game.Lighting.Bob
Now I wanted the player to spawn as Bob so do I clone Bob and move his components to the player and delete the player's limbs? Help!
Destroy the character when it spawns, set the character property of the Player to that model.
The model must have the appropriate children for it to work - Head, and Humanoid. If you want it to be able to walk and stuff then Clone
the Animate
localscript and place it into the new character, but make sure you have Arms and Legs in your model
Also, Lighting isn't meant to be used for storage, use ServerStorage
.
Example;
local model = game.ServerStorage.Bob --Model game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function(char) local anim = char:WaitForChild('Animate'):Clone() char:Destroy() local newChar = model:Clone() anim.Parent = newChar newChar.Parent = workspace plr.Character = newChar end) end)
I'd like to know more about this too. I've experimented with different possibilities without success. I have changed the nested anonymous functions to just one anonymous function. That seems to get rid of the infinite recursing error thrown by the code @Goulstem posted.
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:wait() -- magic goes here to use a different model as the character end)
Can anyone provide some code that works? Thanks!