Hey there,
This is my first post, please be gentle
I'm a somewhat moderate scripter trying to make a simple knife script. I've been working on the local script first. In play solo it works fine, but when I hit run I get an error!
Humanoid is not a valid member of Model
Here is the script:
-- Made by Chardinok no steal por favor
-- Variables
local tool = script.Parent
local plr = game:GetService("Players").LocalPlayer
local chr = plr.Character or plr.CharacterAdded:wait()
local hum = chr.Humanoid
print(hum)
local animating = false
-- Animations
local stabanim = Instance.new("Animation")
stabanim.AnimationId = "rbxassetid://2306972447"
tool.Activated:connect(function()
if animating == false then
animating = true
local stabtrack = hum:LoadAnimation(stabanim)
stabtrack:Play()
wait(0.5)
stabtrack:Stop()
animating = false
end
end)
I appreciate every response.

4 comments
Just saying I have school tomorrow, I won't be able to respond to anything for pretty much the whole day.
The problem is that you are trying to reach
Humanoidbefore it loads in, so just change line 7 to `chr:WaitForChild("Humanoid")Thanks, I’ll try that when I get home from school tomorrow!
:wait is deprecated use :Wait, and :connect is also deprecated so use :Connect