Custom Animate script getting replaced by the default one

I have imported a rigged character model I made in blender and animated it using Roblox Studious’s built-in animator.

To play my custom animation when I am using my custom “Animate” script inside the custom model “StarterCharacter” and “play” the game, the custom “Animate” script inside the custom model “StarterCharacter” gets replaced by the default “Animate” script resulting my model to unable to play the custom animation.

Is there any way to fix this?

Animate Script:

local RunService = game:GetService("RunService")

local character = script.Parent
local Humanoid = character:WaitForChild("Humanoid")

local idleAnim = script:WaitForChild("Idle")
local idleAnimTrack = Humanoid.Animator:LoadAnimation(idleAnim)

local walkAnim = script:WaitForChild("Walk")
local walkAnimTrack = Humanoid.Animator:LoadAnimation(walkAnim)

local runAnim = script:WaitForChild("Run")
local runAnimTrack = Humanoid.Animator:LoadAnimation(runAnim)

local jumpAnim = script:WaitForChild("Jump")
local jumpAnimTrack = Humanoid.Animator:LoadAnimation(jumpAnim)

local fallAnim = script:WaitForChild("Fall")
local fallAnimTrack = Humanoid.Animator:LoadAnimation(fallAnim)


Jumped = false



Humanoid.Running:Connect(function(speed)
	if speed == 0 then
		idleAnimTrack:Play()
		walkAnimTrack:Stop()
		runAnimTrack:Stop()
		
		
	elseif speed > 1.5 and speed < 9 and not walkAnimTrack.IsPlaying then 
		walkAnimTrack:Play()
		idleAnimTrack:Stop()
		runAnimTrack:Stop()
		
	elseif Humanoid.WalkSpeed >= 9 and not runAnimTrack.IsPlaying then
		
		walkAnimTrack:Stop()
		runAnimTrack:Play()
		
		runAnimTrack:AdjustSpeed(1.5)
		
	end
	end)




local function StateChanged(OldState, NewState)
	if NewState == Enum.HumanoidStateType.Freefall then
		Jumped = true
		jumpAnimTrack:Play()
		
		local Start = tick()
		while Jumped do
			if tick() - Start >= 0.5 then
				fallAnimTrack:Play()
				jumpAnimTrack:Stop()
				break
			end
			RunService.Heartbeat:Wait()
		end
	elseif NewState == Enum.HumanoidStateType.Landed then
		Jumped = false
		fallAnimTrack:Stop()
		jumpAnimTrack:Stop()
		
	end
end

StateChangedEvent = Humanoid.StateChanged:Connect(StateChanged)

Character Model:

image

Are you sure it’s getting replaced? Are you setting both animation ids for the action type (in-script and in AnimationId)? If that doesn’t work, add some inoffensive lines of code that are different from the default on, for comparation.

Or uhh, what kind of Animate script are you using?

Yes, I am pretty sure it is getting replaced because I am using a different script than the default one.
I have updated the post with more info as you asked for. TY.

don’t place it in the StarterCharacter put it in StarterCharacterScripts

2 Likes

TYSM it is perfectly working now.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.