Fatal error on my script of disabling ProximityPrompts

i think that would work but somethings wrong with detecting the humanoid, ive been having this problems since yesterday, everytime i try to locate the humanoid it says attempt to index nil with humanoid

local player = game.Players.LocalPlayer

local character = player.Character

local humanoid = character.Humanoid

if humanoid.Sit == true then

for _, proximityPrompts in pairs(player.PlayerGui.ProximityPrompts:GetChildren()) do

proximityPrompts.Enabled = false

end

else

for _, proximityPrompts in pairs(player.PlayerGui.ProximityPrompts:GetChildren()) do

proximityPrompts.Enabled = true

end

end

somethings wrong with the prefformated text too lol