What we've got here is a small local-script located in StarterCharacterScripts that (I don't know if giving a breakdown of it is redundant, I'm new to this website) listens to player input concerning the keycode "S", which is my choice for if the player moves backwards.
The error is whenever I run the game and try moving my character backwards with the "S" key, the following message appears in the output each input. The error source is this local script, on line 5.
22:00:04.265 - attempt to call a userdata value
Here is the code:
local UserInputService = game:GetService("UserInputService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local backwards_anim = ReplicatedStorage:WaitForChild("backwards_anim") local humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid") local function inputbegan(inputObject, gameProcessedEvent) if gameProcessedEvent then return end if inputObject.UserInputType == Enum.UserInputType.Keyboard then local KeyCode = inputObject.KeyCode if KeyCode == Enum.KeyCode.S then humanoid:GetState(state) if state == Enum.HumanoidStateType.Running or Enum.HumanoidStateType.RunningNoPhysics then backwards_anim:FireServer(humanoid) print("Animation request!") end end end end UserInputService.InputBegan:Connect(inputbegan)
Any help would be greatly appreciated!