Shift lock disabling the Shift keys?

The ‘LeftShift’ key doesn’t work when shift lock is enabled.

Does anyone have a idea how to bypass this, that if shift lock key is pressed (Even though shift lock is enabled), it still works.

game:GetService("UserInputService").InputBegan:Connect(function(key,gpe)
	if key.KeyCode == Enum.KeyCode.LeftShift and not gpe then
		if runcd == true then return end
		runcd = true
		runtrack:Play()
		hum.WalkSpeed = hum.WalkSpeed + 8
		
	end
end)

I tried googling it and I searched deep, as it seems nobody posted about this before.
If you have any questions for me, please comment. I’ll respond asap.

Edit : To explain the variables. runcd = cooldown
runtrack = hum:LoadAnimation(run) and run is the animation with the animationid

By the way, you never set runcd to false, so that would run only once.
Never mind, misunderstood.

game:GetService("UserInputService").InputEnded:Connect(function(key,gpe)
	if key.KeyCode == Enum.KeyCode.LeftShift and not gpe then
		if runcd == false then return end
		runcd = false
		runtrack:Stop()
		hum.WalkSpeed = hum.WalkSpeed - 8
	end
end)```

the input ended script  ^

Your variable “gpe” is short for GameProcessedEvent, so when you’re checking if “not gpe” you’re checking if the game has already used the Left Shift, which would be the case if ShiftLock was enabled.

So in this case it will never trigger because the game has already used the Shift keypress for the ShiftLock action.

You could take “and not gpe” out, but you would need to be careful of other edge cases like if they are chatting, although that may not matter much.

2 Likes

It wouldn’t matter if they’re chatting as they won’t be moving unless they focused the chat box while moving, as it would just change movement speed.