Trying to have a crouching system where some areas you cannot stop crouching, this way i thought what if there is a part where whenever you touch it the game thinks you are holding down c, the crouching bind, and you wouldnt be able to stop? the script below doesnt work
local part = script.Parent
local function HoldC()
local input = game:GetService("UserInputService")
input.KeyEvent:Fire({ KeyCode = Enum.KeyCode.C, UserInputType = Enum.UserInputType.Keyboard }, true)
end
local function onTouch(otherPart)
local humanoid = otherPart.Parent:FindFirstChildOfClass("Humanoid")
if humanoid then
HoldC()
end
end
part.Touched:Connect(onTouch)