The animation from blender on the local script is not working

I want for the animation from blender to be working especially on my own local script. And to be working.

For some reason when I am putting instance of animation, animator and animationTrack. Especially for default by loading its own animation in the StarterCharacterScripts. It would still be not working. But in the rig it is working and it is working also by doing import on my own moon animator and insert it into a rig. The PrimaryPart is automatically set to HumanoidRootPart.



There is my fellow code:

local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer

local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")

-- Create and load the animation
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://127186278316900" -- Verify this ID is correct

local animationTrack = animator:LoadAnimation(animation)

-- Play the animation when "K" is pressed
UserInputService.InputBegan:Connect(function(input, gameProcessed)
	if gameProcessed then return end
	if input.KeyCode == Enum.KeyCode.K then
		print("Pressed K!")
		animationTrack:Play()
	end
end)

-- Debug prints
print("Character:", character)
print("Humanoid:", humanoid)
print("Animator:", animator)
print("AnimationTrack:", animationTrack)

I try lot of different solutions, primarily looking for it in the Developer Hub but come to no clear clues as I’m looking over more then several different post. As well experimenting with unique animation type but to no clear once again. As well using AI tool and whole of the internet for it.

I’m currently trying it for myself, but no past progress for past couple of day on it. I’m keeping and keeping pushing myself to find the solution to myself.

Have you set the AnimationPriority to Action?

Yes I did

I already figured out what is the issue after debugging it, It turned out to be that the avatar type for the game is R15, but it should be R6 in order to be working probably!

local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer

local character = player.Character or player.CharacterAdded:Wait()
--local humanoid = character:WaitForChild("Humanoid")
--local animator = humanoid:WaitForChild("Animator")

-- Create and load the animation
--local animation = Instance.new("Animation")
--animation.AnimationId = "rbxassetid://83642013652857" -- Verify this ID is correct
--animation.AnimationId = "rbxassetid://507771019"

--local animationTrack = animator:LoadAnimation(animation)


local function setupCharacter(character)
	local humanoid = character:WaitForChild("Humanoid")
	local animator = humanoid:WaitForChild("Animator")
	local animation = Instance.new("Animation")
	animation.AnimationId = "rbxassetid://83642013652857" -- Replace with new ID
	animationTrack = animator:LoadAnimation(animation)

	-- Wait for load
	--repeat wait() until animationTrack.IsLoaded
	print("Client: RigType:", humanoid.RigType)
	print("Client: AnimationTrack:", animationTrack)
	print("Client: Length:", animationTrack.Length)
	if animationTrack.Length > 0 then
		print("Client: Animation ready")
	else
		print("Client: Animation empty")
	end
end

player.CharacterAdded:Connect(setupCharacter)
if player.Character then
	setupCharacter(player.Character)
end

-- Play the animation when "K" is pressed
UserInputService.InputBegan:Connect(function(input, gameProcessed)
	if gameProcessed then return end
	if input.KeyCode == Enum.KeyCode.K then
		print("Pressed K!")
		animationTrack:Play()
	end
end)

-- Debug prints
print("Character:", character)
--print("Humanoid:", humanoid)
--print("Animator:", animator)
print("AnimationTrack:", animationTrack)


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