The same thing. By the way, where should this be, PlayerScripts or CharacterScripts?
Judging by the script it should belong in StarterPlayerScripts
I still receive this error:
LoadAnimation requires the Humanoid object (matthewthekider.Humanoid) to be a descendant of the game object - Client - Crouch:19 ```
I removed or player.CharacterAdded:Wait()
and now I recieve this error: Players.matthewthekider.PlayerScripts.Crouch:5: attempt to index nil with 'Humanoid'
I do not believe this is correct: local Humanoid = Character:WaitForChild('Humanoid')
Current script:
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local UIS = game:GetService("UserInputService")
local Character = player.Character --or player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild('Humanoid')
local Animation = Instance.new("Animation")
Animation.Name = 'CrouchAni'
Animation.AnimationId = "rbxassetid://7330148777"
UIS.InputBegan:Connect(function(Key, Chatted)
if Chatted then
return
end
if Key.KeyCode == Enum.KeyCode.C then
Animation.Parent = Character
local Crouch = Humanoid:LoadAnimation(Animation)
Crouch:Play()
end
end)
Put it in StarterCharacterScripts instead. It seems to work fine for me.
Omg, I got it. I positioned the animation before I started using the animation editor so there was basically no animation.
@JackscarIitt and also @benpinpop @Synxcious, thank you all very much for the help, sorry that I made that stupid mistake which could have solved this issue an hour or 2 ago.