I have this script under StarterCharacterScripts that is supposed to choose a random animation every time the key "F" is pressed, but I get the error listed above.
Here is my code:
local player = game.Players.LocalPlayer repeat wait() until player.Character local character = player.Character local deb = false local anim1 = Instance.new("Animation") local anim2 = Instance.new("Animation") anim1.AnimationId = 4958723922 anim2.AnimationId = 4958704831 local track1 = character:FindFirstChild("Humanoid"):LoadAnimation(anim1) local track2 = character:FindFirstChild("Humanoid"):LoadAnimation(anim2) local random = Random.new(track1, track2) local UIS = game:GetService("UserInputService") UIS.InputBegan:Connect(function(input, proc) if not proc then if input.KeyCode == Enum.KeyCode.F and deb == false then deb = true random:Play() wait(1) deb = false end end end)
Please help me fix this, I think it's something to do with using "Random" instead of an ID, but I don't know any other way to do this.
You need to set the id WITH https://rblxassetid or something like that
You have to put rbxassetid://
in front of the animation id. For example,
"rbxassetid://4958723922" "rbxassetid://4958704831"
Note that the animation id has to be a string.