You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I would like to be able to use the animation ID -
What is the issue? Include screenshots / videos if possible!
the game says:Invalid animation id '<error: unknown AssetId protocol>':
The line that is giving problems is the 24
the script is:
--// Configuration
local RunService = game:GetService("RunService")
local keybind = "C"
local animationId = 11580217631 --> Replace the number with your animation ID!
local idleAnimationid = 11580734421
--// Variables
local UserInputService = game:GetService("UserInputService")
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animation = Instance.new("Animation")
animation.AnimationId = 'rbxassetid://' .. animationId
local idleAnimation = Instance.new("Animation")
idleAnimation.AnimationId = 'tbxassetid://' .. idleAnimationid
local animationTrack = humanoid:WaitForChild("Animator"):LoadAnimation(animation)
animationTrack.Priority = Enum.AnimationPriority.Action
local idleAnimationtrack = humanoid:FindFirstChild("Animator"):LoadAnimation(idleAnimation)
idleAnimationtrack.Priority = Enum.AnimationPriority.Action
local crouching = false
--// Functions
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if gameProcessedEvent then return end
if input.KeyCode == Enum.KeyCode[keybind] then
if crouching then
humanoid.WalkSpeed = 16
crouching = false
animationTrack:Stop()
character.HumanoidRootPart.CanCollide = true
else
humanoid.WalkSpeed = 7
crouching = true
animationTrack:Play()
character.HumanoidRootPart.CanCollide = false
end
end
end)
local function IsPlayerMoving()
if humanoid.MoveDirection.Magnitude == 0 then
if crouching == true then
--player isn't moving while crouching
animationTrack:Stop()
idleAnimationtrack:Play()
end
elseif humanoid.MoveDirection.Magnitude > 0 then
if crouching == true then
--player is moving while crouching
idleAnimationtrack:Stop()
animationTrack:Play()
end
end
end
--Functions started
RunService.RenderStepped:Connect(IsPlayerMoving)
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried searching around