Boring Stuff: When I try to run this script, it keeps creating clones and crashing with the error: Maximum event re-entrancy depth exceeded for Player.CharacterAdded
This system is intended to force a player’s character to a specific appearance for the experience. However it’s been having a few… well… issues.
In ReplicatedStorage there will be 8 HumanoidDescriptions (in models) with unique identites, I’ve already gotten the picking out system but now I need to actually apply the appearance.
TLDR: I don’t know why but it’s looping the script and creating clones.
local RepStorage = game:GetService("ReplicatedStorage") local Characters = RepStorage.StarterCharacters local UsedCharacters = RepStorage.UsedStarterCharacters local PlayerService = game:GetService("Players") PlayerService.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) local Character = math.random(1,#Characters:GetChildren()) local SelectedCharacter = Characters:GetChildren()[Character] -- everything before this works properly player:LoadCharacterWithHumanoidDescription(SelectedCharacter.HumanoidDescription) -- the problem child SelectedCharacter.Parent = UsedCharacters -- this should be fine end) end)
I am getting a suspicion that when I do LoadCharacterWithHumanoidDescription it triggers the CharacterAdded event again too…