Using custom animations for a custom character

Hello, I’ve got an issue.

When the player presses the button, he gets transformed into an arachnid. Now the arachnid has animations which have been uploaded, but whenever I transform, the Arachnid does not animate.

Button script;

script.Parent.MouseButton1Down:connect(function()
workspace.RemoteEvent.transform:FireServer("Arachnid") --Change name to model as needed
end)

Arachnid Explorer View;
https://gyazo.com/fbfde8cc6fcc7090add918f0036ac535

The Server Event script (which has a remoteevent named ‘transform’ parented to it;

repeat wait() until script.transform
 script.transform.OnServerEvent:connect(function(player, monster)
 local c = game.ServerStorage.CharacterModels[monster]:Clone()
 c.Name="StarterCharacter"
 c.Parent=game.StarterPlayer
 player:LoadCharacter()
 print(c)
 wait(.1)
 c:remove()
end)

Now there is a local script inside the arachnid, named “Other” (which does not get actived for some reason), which searches for the original animate script, deletes it, then enables the Arachnid animations. This does not happen, why is that?

Other script;

for i,child in pairs(script.Parent:GetChildren()) do
 if child.Name == 'Animate' then
  child:Destroy()
  print('hi')
  script.Parent.Animate2.Disabled = false
 end
end

EDIT: The scripts in the Arachnid model are not transferring over to the player in the workspace when the transformation happens.
https://gyazo.com/325db720f9f5cc6ddcd241c0a038571f

Thanks. If you need any clarification, let me know.

If I am not mistaken, you do not have a script named Animate in the arachnid model, which is why the code is not working.

You have one named Animate2, but that is not what the if statement is looking for, so it does not work.

I did not notice the edit. It’s best to reply so that others can see the notification.

For scripts in the character, you have to place them under game.StarterPlayer.StarterCharacterScripts in order for them to be placed within the model.

To help you since this does not take much time, here is what your new code should look like:

Server:

local starterP = game.StarterPlayer

repeat 
    wait() 
until script.transform

script.transform.OnServerEvent:connect(function(player, monster)
	local c = game.ServerStorage.CharacterModels[monster]:Clone()
	
	c.Name =" StarterCharacter"
	c.Parent = starterP

	-- Now we place the scripts into the Starter Character Scripts.

	c.Animate2.Parent = starterP.StarterCharacterScripts
	c.OnKeyAnim.Parent = starterP.StarterCharacterScripts
	c.Other.Parent = starterP.StarterCharacterScripts
	
	player:LoadCharacter()
	
	print(c)
	wait(.1)
	c:remove()

        -- Now we remove them just like the model.

        starterP.StarterCharacterScripts.Animate2.Parent = nil
        starterP.StarterCharacterScripts.OnKeyAnim.Parent = nil
        starterP.StarterCharacterScripts.Other.Parent = nil
end)

Other’s Script:

repeat
    wait()
until script.Parent.Animate2 -- Added this since 'Other' may load before 'Animate2.'

for i, child in pairs(script.Parent:GetChildren()) do
    if child.Name == 'Animate' then
        child:Destroy()
        print('hi')
        script.Parent.Animate2.Disabled = false
    end
end

NOTE: Make sure the Animate2 script is a local script, otherwise, the animations will not play.

1 Like

Oh, I see where I went wrong. Thanks for the help!!

Nevermind, dont mind this comment. Question the same thing

On the top of each category, to the right there is a button that says “Create Topic” Press it.
https://gyazo.com/60534a31df19aa68d783f03e4f084027