Animation wont play when changing character

I am trying to make a troll game where you drink the cup to turn into a trollge incident.

When I become a troll the animations wont play

DevForum and other stuff.

I am changing the character from the server, then I am enabling the Animate script after adding it into the character. I also have a delay to enable it.

--// Changes Avatar \\--
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Trolls = ReplicatedStorage.Trolls
local Tools = ReplicatedStorage.Tools

script.LocalScript.Main.OnServerEvent:Connect(function(player)
	local chosenTroll = Trolls:GetChildren()[math.random(1,#Trolls:GetChildren())]
	warn(player.Name.."(s) troll is",chosenTroll.Name)
	local character = chosenTroll:FindFirstChild("MainCharacter"):Clone()
	local oldCharacter = player.Character
	
	character:SetPrimaryPartCFrame(oldCharacter.PrimaryPart.CFrame)
	
	character.Name = player.Name
	player.Character = character
	character.Parent = workspace
	
	
	player:WaitForChild("Backpack"):ClearAllChildren()
	local ChosenTools = Tools[chosenTroll.Name]
	
	for _,tool in pairs(ChosenTools:GetChildren()) do
		tool = tool:Clone()
		tool.Parent = player:WaitForChild("Backpack")
	end
	
	local animate = Trolls[chosenTroll.Name]:FindFirstChild("Animate"):Clone()
	animate.Parent = player.Character
	
	
	script.Parent.Parent:Destroy()
	task.wait(0.5)
	animate.Disabled = false
end)

It inserts it and the Humanoid is set to R6 just like how it’s meant to be.

1 Like

It’s most likely because you are destroying the script’s parent before it can set the animate disabled to false.

Also I recommend setting the character’s parent to workspace before applying it to the player’s character property, to prevent any possible issues with the character object being in ‘nil’ via Clone().

Okay also I checked in explorer, the Animate script is enabled when put into the character