Hello, I have an error in my code… The error is Maximum event re-entrancy depth exceeded for Player.CharacterAdded
and because, in the script I need help with, the players character is changed, which makes the CharacterAdded function to occur again. I want the player to spawn in with a custom rig whenever they spawn in, which is how I have it right now. I could add it into StarterCharacter, but im goign to have multiple in the future and have different characters for different classes, so I am just testing out like this for now. Is there anyway how i can change the players character without having it break with the error above? And also, when I duplicate the “Animate” script, the animations in the character do not work, and the body colors dont change ;(
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local description = character.Humanoid:GetAppliedDescription()
description.Shirt = "http://www.roblox.com/asset/?id=7828726929"
description.Pants = "http://www.roblox.com/asset/?id=7828725684"
local newChar = script.GOfficer:Clone()
newChar.Parent = workspace
newChar.Humanoid:ApplyDescription(description)
player.Character = newChar
for i,v in ipairs(character:GetChildren()) do
if v:IsA("BaseScript") then
v.Parent = newChar
end
end
character:Destroy()
end)
end)