I have this code that should make the player no able to jump or press c or shift when his down but it's not working i asked chat GPT for help before coming here and its still not working im a beginner btw and need help
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ContextActionService = game:GetService("ContextActionService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character
local function disableKeys()
local function Sink()
return Enum.ContextActionResult.Sink
end
ContextActionService:BindActionAtPriority(
"DisableKeys",
Sink,
false,
Enum.ContextActionPriority.High.Value,
Enum.KeyCode.LeftShift,
Enum.KeyCode.RightShift,
Enum.KeyCode.C
)
end
local function enableKeys()
ContextActionService:UnbindAction("DisableKeys")
end
-- Function to check if the player is downed
local function isPlayerDowned(player)
if character and character:FindFirstChild("IsDowned") then
return character.IsDowned.Value
end
return false
end
local function updateKeyState()
local humanoid = player.Character and player.Character:FindFirstChildOfClass("Humanoid")
if humanoid then
if isPlayerDowned(player) then
disableKeys()
humanoid.JumpHeight = 0 -- Disable jumping
else
enableKeys()
humanoid.JumpHeight = 7.2
end
end
end