I have a brawler game, and inside of replicated storage, I've got some fake arms that are raycasted and animated. My question is, how do I actually make it so that when I press "e" or press left click, it plays the animations? because with the script I have right now, it doesn't do anything. Here's my code, tell me where I went wrong, and what I can do instead
local player = game.ReplicatedStorage.Arms
repeat wait() until player.Character.Humanoid
local humanoid = player.Character.Humanoid
local mouse = player:GetMouse()
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid//:noseeslol"
mouse.KeyDown:connect(function(key)
if key == "r" then
local playAnim = humanoid:LoadAnimation(anim)
playAnim:Play()
end
end)

3 comments
It might work, but "humanoid" and "(anim)" in line 13 are marked as unknown
Define humanoid, I forgot to do that.
Ok, so I'll do local humanoid=game.players.LocalPlayer:findfirstchild"humanoid"?