Custom cloned character doesn't have animation

Hello Developers,

For the past few minutes, I have try to figure out how to give my custom character animation after the player character got set to the custom character. But it seems like when I set the player character to the custom character, the “animate” and “health” script is not in the custom character. Idk why but please help me!

--- // Services // ---

local Players = game:GetService('Players')
local Workspace = game:GetService('Workspace')
local RepStorage = game:GetService('ReplicatedStorage')

--- // Player Objects // ---

local Player = Players.LocalPlayer

local PlayerCamera = Workspace.CurrentCamera

--- // Numbers, Booleans, Strings, Tables, and Datas // ---

local ListIndex = 0

local CharactersList = {
	RepStorage:WaitForChild('CharactersFolder').Alluka; -- 1
	RepStorage:WaitForChild('CharactersFolder').Bonolenov; -- 2
	RepStorage:WaitForChild('CharactersFolder').Character1; -- 3
	RepStorage:WaitForChild('CharactersFolder').Character2; -- 4
	RepStorage:WaitForChild('CharactersFolder').Chrollo; -- 5
	RepStorage:WaitForChild('CharactersFolder').Feitan; -- 6
	RepStorage:WaitForChild('CharactersFolder').Franklin; -- 7
	RepStorage:WaitForChild('CharactersFolder').Ging; -- 8
	RepStorage:WaitForChild('CharactersFolder')["Gon Freecs"]; -- 9
	RepStorage:WaitForChild('CharactersFolder').Illumi; -- 10
	RepStorage:WaitForChild('CharactersFolder').Kallutob; -- 11
	RepStorage:WaitForChild('CharactersFolder').Killua; -- 12
	RepStorage:WaitForChild('CharactersFolder').Kortopi; -- 13
	RepStorage:WaitForChild('CharactersFolder').Kurapika; -- 14
	RepStorage:WaitForChild('CharactersFolder').Leorio; -- 15
	RepStorage:WaitForChild('CharactersFolder').Machi; -- 16
	RepStorage:WaitForChild('CharactersFolder').Meruem; -- 17
	RepStorage:WaitForChild('CharactersFolder').Nobunaga; -- 18
	RepStorage:WaitForChild('CharactersFolder').Phinks; -- 19
	RepStorage:WaitForChild('CharactersFolder').Shalnark; -- 20
	RepStorage:WaitForChild('CharactersFolder').Shizuku; -- 21
	RepStorage:WaitForChild('CharactersFolder').Youpi; -- 22
	RepStorage:WaitForChild('CharactersFolder').uvo; -- 23
	RepStorage:WaitForChild('CharactersFolder').TESTRIG -- 24
}

local WhitelistID = {
	[1] = {};
	[2] = {};
	[3] = {};
	[4] = {};
	[5] = {};
	[6] = {};
	[7] = {};
	[8] = {};
	[9] = {};
	[10] = {};
	[11] = {};
	[12] = {};
	[13] = {};
	[14] = {};
	[15] = {};
	[16] = {};
	[17] = {};
	[18] = {};
	[19] = {};
	[20] = {};
	[21] = {};
	[22] = {};
	[23] = {};
	[24] = {4081567101};
}

--- // Functions, Setups, and Events // ---

local function FindPlayerIdInTable(PlayerToGetID: Player, TableToFind: {number})
	if table.find(TableToFind, PlayerToGetID.UserId) then
		return table.find(TableToFind, PlayerToGetID.UserId)
	end
end

while task.wait() do
	ListIndex += 1
	if FindPlayerIdInTable(Player, WhitelistID[ListIndex]) ~= nil then
		print('The chosen character is: '..CharactersList[ListIndex].Name)

		local NewCharacter = CharactersList[ListIndex]:Clone()
		NewCharacter:WaitForChild('HumanoidRootPart').Anchored = false
		NewCharacter.Parent = Workspace
		NewCharacter.Name = Player.Name

		Player.Character = NewCharacter
		PlayerCamera.CameraSubject = Player.Character:WaitForChild('Humanoid')
		break
	end
end
1 Like