I’ve been trying to get this animation to play when I press E, but for some reason it’s not working. Tried searching up yt vids about keybinds but the scripts look the same, please help. This is the code
local player = game.Players.LocalPlayer
local UIS = game:GetService("UserInputService")
local store = game:GetService("ServerStorage")
local enabled = true
local karsQ = store.KarsAnim.KarsBarrage
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E and enabled == true then
enabled = false
local char = game.Workspace:WaitForChild(player.Name)
local h = char:WaitForChild("Humanoid")
local x = h:LoadAnimation(karsQ)
x:Play()
wait(2)
enabled = true
end
end)
The reason why the script isn’t working is because you’re trying to get ServerStorage. Remove that line and you’re fine. The client can’t get ServerStorage because Roblox made it always hidden to the client. However, ServerScripts are able to get the services ServerStorage and ServerScriptService.
there’s two arguments in InputBegan, “Input” and “GameProcessed”. you have to use two arguments in that order, because you used the GameProcessed argument instead of input.
you have to use two arguments in the function, “Input” and “GameProcessed” in that order. You’re using the gameprocessed argument instead of the input.