The title says what i am trying to accomplish , but it gives
Humanoid is not a valid member of Player “Players.CENABOOSS” which is my name
how do i fix it
below is the code used
animation id is child of the script and tool is the parent of the script
local player = script.Parent.Parent.Parent
local humanoid =player.Humanoid
local UIS = game:GetService("UserInputService")
local anim = script:WaitForChild("Animation")
local animTrack = humanoid.Animator:LoadAnimation(anim)
animTrack = humanoid:LoadAnimation(anim)
UIS.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton2 then
animTrack:Play()
end
end)
UIS.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.Mouse2 then
animTrack:Stop()
end
end)