Animation not updating

why is the animations not updating instantly, how can i fix this?
issue is when the player animation is changed, it doesnt update instantly player has to move.

local possiblestates = {
	Running = onRunning,
	Died = onDied,
	Jumping = onJumping,
	Climbing = onClimbing,
	GettingUp = onGettingUp,
	Freefall = onFreeFall,
	FallingDown = onFallingDown,
	Seated = onSeated,
	PlatformStanding = onPlatformStanding,
}

game:GetService('ReplicatedStorage'):WaitForChild('Remotes'):WaitForChild('Override').OnClientEvent:Connect(function()
	print('Fired')

	local Character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait();
	for i, v in ipairs{"idle", "walk", "run", "jump", "fall"} do
		print(animNames[v])
		animNames[v][1].id = script[v]:FindFirstChildWhichIsA("Animation").AnimationId
	end
	for name, fileList in pairs(animNames) do 
		configureAnimationSet(name, fileList)
	end
	possiblestates[Humanoid:GetState().Name](Character.HumanoidRootPart.Velocity.Magnitude)
end)
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local Remotes = ReplicatedStorage.Remotes
local Override = Remotes.Override

local AnimationManager = {}

function AnimationManager:CopyAnimationPresets(Player, PresetTable)
	local Character	
	if Player:IsDescendantOf(Players) then
		Character = Player.Character
	else
		Character = Player
	end

	local Humanoid = Character:WaitForChild('Humanoid')
	local AnimateScript = Character:FindFirstChild('Animate')

	print('Player is rendered')

	local AnimationPresetNames = {
		['idle'] = 'Animation1',
		['idle2'] = 'Animation2',
		['fall'] = 'FallAnim',
		['climb'] = 'ClimbAnim',
		['walk'] = 'WalkAnim',
		['run'] = 'RunAnim'
	}

	for AnimationName, ID in pairs(PresetTable) do
		if AnimateScript[string.lower(AnimationName)] and ID then
			local PresetName = AnimationPresetNames[string.lower(AnimationName)]
			local PlayerAnimation = AnimateScript[string.lower(AnimationName)][PresetName]

			for _, PlayingTrack in pairs(Humanoid.Animator:GetPlayingAnimationTracks()) do
				if PlayingTrack.Name:match(AnimationPresetNames[string.lower(AnimationName)]) then
					PlayingTrack:Stop(0)
				end
			end

			local Tracks = Humanoid:GetPlayingAnimationTracks()

			for _, thistrack in pairs(Tracks) do
				thistrack:Stop()
				thistrack:Destroy()
			end

			if PresetName == 'Animation1' then
				PlayerAnimation.AnimationId = string.format('rbxassetid://%s', tostring(ID))
				local idlevalue = PlayerAnimation.Parent
				idlevalue:FindFirstChild('Animation2').AnimationId = string.format('rbxassetid://%s', tostring(ID))

				AnimateScript[string.lower(AnimationName)]['Animation1'].AnimationId = string.format('rbxassetid://%s', tostring(ID))
				AnimateScript[string.lower(AnimationName)]['Animation2'].AnimationId = string.format('rbxassetid://%s', tostring(ID))
				Override:FireClient(Player)
				local Idle1 = Humanoid.Animator:LoadAnimation(AnimateScript[string.lower(AnimationName)]['Animation1'])
				local Idle2 = Humanoid.Animator:LoadAnimation(AnimateScript[string.lower(AnimationName)]['Animation2'])
			else
				PlayerAnimation.AnimationId = string.format('rbxassetid://%s', tostring(ID))
				Override:FireClient(Player)
				local animation = Humanoid.Animator:LoadAnimation(PlayerAnimation)
			end
		end
	end
end

return AnimationManager

First of all, make sure both scripts are on the client.

And double check your variables that your using like AnimateScript[string.lower(AnimationName)][‘Animation1’]

so

print(AnimateScript[string.lower(AnimationName)]['Animation1'])
-- and
print(AnimateScript[string.lower(AnimationName)]['Animation2'])
-- And make sure each one is not null.

It also looks like your AnimationManager is on the Server Animations Cannot Be Controlled By The Server, change your context to client.

^ So that would be the issue.

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