Really confused, saying humanoid doesnt exist

code:

-- COPYRIGHT 2020 RAMPAGE Interactive LLC
-- Written by: vq9o
repeat wait(1) until game.Players.LocalPlayer.Character.Humanoid

-- Services
local lighting = game:GetService("Lighting")
local usi = game:GetService("UserInputService")
local players = game:GetService("Players")
local Player = players.LocalPlayer
local Humanoid = Player.Character:FindFirstChild("Humanoid")

-- Varaibles
local sit = false
local blur = Instance.new("BlurEffect", lighting)
blur.Size = 14
blur.Name = "AnimationBlur"

-- Health
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://5849786322"
local animation = Player.Character.Humanoid:LoadAnimation(Anim)
Humanoid.Changed:Connect(function()
	if Humanoid.Health <= 25 then
		blur.Enabled = true
		animation:Play()
		animation:AdjustSpeed(1)
		animation.Priority = Enum.AnimationPriority.Action
		Humanoid.WalkSpeed = 0
		wait(6)
		if Humanoid.Health <= 25 and Humanoid.Health >= 1 then
			game.ReplicatedStorage.Remotes.Server:FireServer("Damage", 100)
		end
	else
		blur.Enabled = false
		animation:Stop()
		Humanoid.WalkSpeed = 16
	end
end)


-- Actions
usi.InputBegan:Connect(function(input, process)
	if input.KeyCode == Enum.KeyCode.L and input.KeyCode == Enum.KeyCode.LeftAlt  then
		print("im hot")
	end
end)


Humanoid.Seated:Connect(function(isSeated, seat)
	if isSeated then
		sit = true
	else
		sit = false
	end
end)

Output:
image

I think that the player loads first and the script starts running before the character spawns so what I would do is hum = workspace:WaitForChild(game.Players.LocalPlayer.Name):WaitForChild(“Humanoid”)

1 Like

Code errored because you’re asking it to wait for Character.Humanoid, when the game hasn’t even loaded in the character yet.

1 Like