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: