"Humanoid is not a valid member of model"

For some reason, in my output everytime i reset the character and respawn, it comes up with the error “Humanoid is not a valid member of model” and it breaks the character.
Heres the script:

local cam = game.Workspace.CurrentCamera

local player = players.LocalPlayer

local m = player:GetMouse()

m.Icon = "http://www.roblox.com/asset/?id=569021388" -- replaces mouse icon

local character = player.Character or player.CharacterAdded:wait()

local human = character.Humanoid

local humanoidpart = character.HumanoidRootPart

Thanks for your help!

Maybe just do a WaitForChild on the Humanoid.

1 Like

same error for some reason, can you specify where to put it please?

The variable which contains the Humanoid instance.

1 Like

thanks for your help! i really appreciate it

1 Like

I fixed the script. Not sure if this was the issue for however it should work? You missed some from local player

local cam = game.Workspace.CurrentCamera

local player = game.Players.LocalPlayer

local m = player:GetMouse()

m.Icon = "http://www.roblox.com/asset/?id=569021388" -- replaces mouse icon

local character = player.Character or player.CharacterAdded:wait()

local human = character.Humanoid

local humanoidpart = character.HumanoidRootPart
1 Like

thanks for replying! i tried it and it also worked but i used the guys aboves script
thanks for helping though, i appreciate it

update. i tried using ur script, but this happens

the knife clients script causes this error and doesn’t respawn the character (this is a local script)

local Player = game:GetService("Players").LocalPlayer

local Tool = script.Parent

local Remote = Tool:WaitForChild("Remote")

local Handle = Tool:WaitForChild("Handle")

local char = Tool.Parent

repeat wait() until game:GetService("Players").LocalPlayer.Character ~= nil

local runService = game:GetService("RunService")

local input = game:GetService("UserInputService")

local players = game:GetService("Players")

local player = players.LocalPlayer

local character = player.Character or player.CharacterAdded:wait()

local human = character.Humanoid

local UIS = game:GetService("UserInputService")

local Mouse = Player:GetMouse()

local Tool = script.Parent

local Remote = Tool:WaitForChild("Remote")

local Tracks = {}

local InputType = Enum.UserInputType

local BeganConnection, EndedConnection

function playAnimation(animName, ...)

if Tracks[animName] then

Tracks[animName]:Play()

else

local anim = Tool:FindFirstChild(animName)

if anim and Tool.Parent and Tool.Parent:FindFirstChild("Humanoid") then

Tracks[animName] = Tool.Parent.Humanoid:LoadAnimation(anim)

playAnimation(animName, ...)

end

end

end

function stopAnimation(animName)

if Tracks[animName] then

Tracks[animName]:Stop()

end

end

function inputBegan(input)

if input.UserInputType == InputType.MouseButton1 then

Remote:FireServer("LeftDown", Mouse.Hit.p)

end

end

function inputEnded(input)

if input.UserInputType == InputType.MouseButton1 then

Remote:FireServer("LeftUp")

end

end

function onRemote(func, ...)

if func == "PlayAnimation" then

playAnimation(...)

elseif func == "StopAnimation" then

stopAnimation(...)

end

end

function onEquip()

BeganConnection = UIS.InputBegan:connect(inputBegan)

EndedConnection = UIS.InputEnded:connect(inputEnded)

end

function onUnequip()

if BeganConnection then

BeganConnection:disconnect()

BeganConnection = nil

end

if EndedConnection then

EndedConnection:disconnect()

EndedConnection = nil

end

end

Tool.Equipped:connect(onEquip)

Tool.Unequipped:connect(onUnequip)

Remote.OnClientEvent:connect(onRemote)

Sorry for the late reply, it was working fine for me, weird. And did the other person solved it?

it solved the camera being funny, but it didnt solve the bug where u stay dead when you get killed with the throwing knife