I know there have been topics on this before like: Getting error "LoadAnimation requires the Humanoid object to be a descendant of the game object" despite waiting for Character, but I either can’t use them for my script or they don’t make sense to me at all. I have made a custom character setup for my game and I always get this annoying Humanoid is not a descendant of game error. I have tried many things, but have failed to do so. Here is my script for changing the default character:
Script
local function CharacterLoop(Player)
if Player.Team.Name == "Luigi" then
Player:LoadCharacter()
local Character = Player.Character
local NewCharacter = game:GetService("ServerStorage"):WaitForChild("Luigi"):Clone()
NewCharacter.Parent = game.Workspace
NewCharacter.Name = Player.Name
Player.Character = NewCharacter
Character = Player.Character
local CameraFixer = script.CameraFixer:Clone()
CameraFixer.Disabled = false
CameraFixer.Parent = Player:WaitForChild("PlayerGui")
-- more of the code continuing
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
Humanoid.Died:connect(function()
wait(5)
CharacterLoop(Player)
end)
end
game.Players.CharacterAutoLoads = false
local function OnPlayerAdded(Player)
CharacterLoop(Player)
end
game.Players.PlayerAdded:connect(OnPlayerAdded)
for _,Player in pairs(game.Players:GetPlayers()) do OnPlayerAdded(Player) end
What I am mainly frustrated about is that the character doesn’t change if you are on the Luigi team, there is also an animation problem with every regular roblox character, but that is not a big problem right now. Other then that everything else works perfectly, changing to the boo custom models and their animations/movements.
Any help is very appreciated!