I Am Making A Simulator and I'm trying to make it when you click an animation plays. and in the output it always says:``
attempt to index nil with 'WaitForChild'
My Script Is:
local UserInputService = game:GetService("UserInputService")
local Tool = script.Parent
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("humanoid")
UserInputService.InputBegan:Connect(function(InputObject)
if InputObject.UserInputType == Enum.UserInputType.MouseButton1 then
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://5230036647"
local Track = Humanoid:LoadAnimation(Animation)
Track:Play()
end
end)
Can anyone Help?
