Error: " 09:22:22.639 - ServerScriptService.Script:5: attempt to index nil with 'LoadAnimation'"
local uip = game:GetService("UserInputService")
local char = script.Parent
local human = char:WaitForChild("Humanoid", 1)
local anim = char:WaitForChild("Lookatwrist", 1)
local animtrack = human:LoadAnimation(anim)
uip.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
animtrack:Play()
print("played")
end
end)
i am trying to make it play a animation when you press e but it wont work please help

7 comments
where is the script located?
your timeout parameter on waitforchild might be the problem. It waited 1 second and then returned nil, because humanoid still wasnt found. I think thats what timeout does from what i saw
nope
also the script is in server script service
wait so where should i set char
if it's in serverscriptservice then it's completely on the server and script.Parent will just return serverscriptservice
well what should i set char as