Change Character Can't Use Animation Error = LoadAnimation requires the Humanoid object (ValiDeveloper.Humanoid) to be a descendant of the game object

  1. I’m trying to make a character selection gui and I made the script but after selecting the character I get an error like this:
    LoadAnimation requires the Humanoid object (ValiDeveloper.Humanoid) to be a descendant of the game object
    unknown|690x15
    there is no animation in my character, so I can’t punch etc.
    Change Character Script is here:
game.ReplicatedStorage.PlayEvents.PlayMalia.OnServerEvent:Connect(function(plr)
		local char = plr.Character
		local customChar = game.ServerStorage.Karakterler.Werewolf.Omega.Malia.MaliaTate --// Character
		gui.Visible = false
		gui2.Visible = false
		gui3.Visible = false
		
		plr:LoadCharacter()
		
		if not char:FindFirstChild("IsCustom") then
			local newChar = customChar:Clone()
			newChar.Name = plr.Name
			newChar.HumanoidRootPart.CFrame = char.HumanoidRootPart.CFrame
			plr.Character = newChar
			newChar.Parent = workspace
		end
	end)

How Can I Solve this please I need help :confused:
[image]

2 Likes

I had this error already and I know how to help!

Get the LocalScript called Animate from your humanoid while in game.

Put the same script in ReplicatedStorage, in a folder or where you want but ReplicatedStorage is the best.

Go to the script and put at the beginning:

repeat wait() until script.Parent:IsA("Humanoid")

then, in the script you have shown, it should look like that.

local animateScript = --put the script here

game.ReplicatedStorage.PlayEvents.PlayMalia.OnServerEvent:Connect(function(plr)
		local char = plr.Character
		local customChar = game.ServerStorage.Karakterler.Werewolf.Omega.Malia.MaliaTate --// Character
		gui.Visible = false
		gui2.Visible = false
		gui3.Visible = false
		
		plr:LoadCharacter()
		
		if not char:FindFirstChild("IsCustom") then
			local newChar = customChar:Clone()
			newChar.Name = plr.Name
			newChar.HumanoidRootPart.CFrame = char.HumanoidRootPart.CFrame
			plr.Character = newChar
            animateScript:Clone().Parent = plr.Character
			newChar.Parent = workspace
		end
	end)

This is how I dealt this 2 months ago while making a commission.

1 Like

I think I made a mistake here it didn’t work
The script became like this and I couldn’t get the character

		local animateScript = game.ReplicatedStorage.Animate

		game.ReplicatedStorage.PlayEvents.PlayMalia.OnServerEvent:Connect(function(plr)
		local char = plr.Character
		local customChar = game.ServerStorage.Karakterler.Werewolf.Omega.Malia.MaliaTate --// Character
		gui.Visible = false
		gui2.Visible = false
		gui3.Visible = false

		plr:LoadCharacter()

		if not char:FindFirstChild("IsCustom") then
			local newChar = customChar:Clone()
			newChar.Name = plr.Name
			newChar.HumanoidRootPart.CFrame = char.HumanoidRootPart.CFrame
			plr.Character = newChar
			animateScript:Clone().Parent = plr.Character
			newChar.Parent = workspace
		end
	end)

the animation is LocalScript as follows

repeat wait() until script.Parent:IsA("Humanoid")

player.Character:WaitForChild("RightHand").Touched:Connect(function(hit)
	if hit and hit.Parent:FindFirstChildWhichIsA("Humanoid") and Punching and hit.Parent.Humanoid ~= player.Character.Humanoid then
		if player.Character.Humanoid.Health > 0 then
			if not isTouched then  -- Check that debounce variable is not true
				isTouched = true
				game.ReplicatedStorage.Punching:FireServer(hit.Parent.Humanoid)
				wait(RESET_SECONDS)  -- Wait for reset time duration
				isTouched = false
			end
		end
	end
end)
--// Malia Punch
UserInputService.InputBegan:Connect(function(input, processed)
	if processed then return end
	
	if input.KeyCode == Enum.KeyCode.F then
		if player.TeamColor == MaliaTeam.TeamColor then
			if not Punching then
				Punching = true
				Punch:Play()
				Punch.Looped = false
				wait(3)
				Punch:Stop()
				Punching = false
			end
		end
	end
end)

I didn’t understand exactly what to do I’m new to Roblox Studio scripting

More precisely, I can get the character, but the same error comes again:
LoadAnimation requires the Humanoid object (ValiDeveloper.Humanoid) to be a descendant of the game object

Do any errors appear in console when testing?

Are you calling the script where the player changes character from a server script?

I Used this scripts for change character on server side, so yes character change script from a server script but animation is a LocalScript
Events
ServerScript
Animation
Animation Script:

repeat wait() until script.Parent:IsA("Humanoid")

player.Character:WaitForChild("RightHand").Touched:Connect(function(hit)
	if hit and hit.Parent:FindFirstChildWhichIsA("Humanoid") and Punching and hit.Parent.Humanoid ~= player.Character.Humanoid then
		if player.Character.Humanoid.Health > 0 then
			if not isTouched then  -- Check that debounce variable is not true
				isTouched = true
				game.ReplicatedStorage.Punching:FireServer(hit.Parent.Humanoid)
				wait(RESET_SECONDS)  -- Wait for reset time duration
				isTouched = false
			end
		end
	end
end)
--// Malia Yumruk
UserInputService.InputBegan:Connect(function(input, processed)
	if processed then return end
	
	if input.KeyCode == Enum.KeyCode.F then
		if player.TeamColor == MaliaTeam.TeamColor then
			if not Punching then
				Punching = true
				Punch:Play()
				Punch.Looped = false
				wait(3)
				Punch:Stop()
				Punching = false
			end
		end
	end
end)

And the FireServer:(player) things here
GUI

local player = game.Players.LocalPlayer

script.Parent.Activated:Connect(function(player)
	game.ReplicatedStorage.ChangeEvents.MaliaChar:FireServer(player)
	game.ReplicatedStorage.TakimEvents.Malia:FireServer(player)
	game.ReplicatedStorage.GuiKapatma:FireServer(player)
	game.ReplicatedStorage.PlayEvents.PlayMalia:FireServer(player)
	game.ReplicatedStorage.TakenEvent.MaliaTaken:FireServer(player)
end)

Yeah I Just get this error when I change character:
LoadAnimation requires the Humanoid object (ValiDeveloper.Humanoid) to be a descendant of the game object

Anyways I Solved this problem with diffrent scripts, thanks for the help :slight_smile:

1 Like