I am trying to make it so when I press "e" on the keyboard, it plays an animation. I feel like the code should be right, but it says in the studio output: "Animation "https://www.roblox.com//asset/?id=https://www.roblox.com/library/963441784/Watch-Check-Animation&serverplaceid=0" failed to load in "Animation.AnimationId": Animation failed to load"
local mouse = game.Players.LocalPlayer:GetMouse() local char = game.Players.LocalPlayer.Character enabled = false function KeyD(key) if enabled then enabled = false key = key:lower() if key == "e" then local emote = Instance.new("Animation") emote.AnimationId = "https://www.roblox.com/library/963441784/Watch-Check-Animation" local animloader = char.Humanoid:LoadAnimation(emote) animloader:Play() end enabled = true end end
Thanks for the help. I guess.
KeyDown is a depricated function a.k.a it can't be used anymore it only works in studio.
it is replaced for ther UserInputService
Do this:
plr = game.Players.LocalPlayer chr = plr.Character game:GetService('UserInputService').InputBegan:Connect(function(input, process) if input.UserInputType == Enum.UserInputType.Keyboard then if input.KeyCode == Enum.KeyCode.E and plr and chr then -- ur animation stuff end end end)
also uhh try to make ur animation a child of the script like this (bcuz it may just be having no parent but the game itself)
local emote = Instance.new('Animation', script)
and also uhhhhhh say the AnimationId is this: "rbxassetid://(ur Idnumber)"