Hi, i don’t know how i can make a random character system on spawn when the team of player is “Civil” here is the code template but no topics on what i want to do.
local charsFolder = game:GetService("ServerStorage"):WaitForChild("chars")
local function pickRandomChar()
local charList = charsFolder:GetChildren()
return charList[math.random(#charList)]
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
print("added")
if player.Team == "Civil" then
local newChar = pickRandomChar()
--magic here
end
end)
end)
Firstly you’ll have to clone the new character ( newChar )
Secondly you’ll have to clone some scripts and such from the old character into the new one,
Those are the following: The humanoid, the animate script.
After you’ve done that you will probably have to rename the new character to your player name (I do not know if this is exactly needed but I’ve done this in my personal script a while ago as the roblox engine is also generating your character with your name)
Then you will want to set player.Character = newChar
And lastly you will want to parent newChar to the workspace
I do not know if it’ll work like this for you since this is just a short summary of what I’ve done in my script, and the last time I changed something at it was a year ago. But this is one way you could go at it.
Ok, add humanoid in StarterPlayer named StarterHumanoid and a model named StarterCharacter and add a base part named HumanoidRootPart and weld it to different parts.
Well one thing I’ve noticed is that the character has no animation because you’ve forgotten to clone the animation script into the new character…
This can be fixed with:
The other thing I’ve noticed is that our system work very different from each other…
Mine uses a GUI button to detects when a player wants to morph into a certain body.
Yours will want to work with when the player spawns, therefore there are a lot of characers cloning because as soon you you do player.Characterplayer.CharacterAdded will be fired until roblox rate limits it. Therefor this error gets created: Maximum event re-entrancy depth exceeded for Player.CharacterAdded
Like I said our system work very differently so I cannot help you to achieve you goal as I have the player manually trigger their change and you’d want it to be automatic and I currently have no idea how to fix the issue with the multiple characters spawning