- LocalScript somehow doesnt get humanoid after I've called it correctly

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local sitting = false
local plr = game.Players.LocalPlayer
local char = plr.Character
local hum = char.Humanoid
local sitAnim = Instance.new("Animation")
sitAnim.AnimationId = "rbxassetid://12305699302"

function sit()
	if sitting then return end
	sitting = true
	hum.Humanoid.JumpPower = 0
	hum.Humanoid.WalkSpeed = 0
	char.Humanoid:LoadAnimation(sitAnim):Play()
end

function stand()
	if not sitting then return end
	sitting = false
	hum.Humanoid.JumpPower = 50
	hum.Humanoid.WalkSpeed = 16
	char.Humanoid:LoadAnimation(nil)
end

mouse.KeyDown:Connect(function(key)
	if key == "g" then
		sit()
	end
end)

mouse.KeyUp:Connect(function(key)
	if key == "g" then
		stand()
	end
end)

That’s the script above I get this error.

This is where the script’s located.
image

You are trying to get the Humanoid from the Humanoid variable.

What is this line here:

hum.Humanoid.JumpPower = 50

Same for other lines.

Oh god, I did not even notice that…

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.