I was creating a sprint and crouch system but found out that studio was glitched as if you held down shift and pressed C, it would not detect you pressing C, only releasing. Here is a file of the example in game, you can try it out and look at the Output. This only happens for the C key too. BrokenUserInput.rbxl (52.8 KB)
local userInputService = game:GetService(“UserInputService”)
userInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.C then
print(“C/Control pressed”)
elseif input.KeyCode == Enum.KeyCode.LeftShift then
print(“Left Shift pressed”)
end
end)
userInputService.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
print(“Left Shift released”)
elseif input.KeyCode == Enum.KeyCode.C then
print(“C/Control released”)
end
end)
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.C then
print("C is being pressed")
end
end)
local userInputService = game:GetService("UserInputService")
local pressedshift = false
local pressedC = false
userInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.C and not pressedshift then
pressedC = true
print("C/Control pressed")
end
if input.KeyCode == Enum.KeyCode.LeftShift and not pressedC then
pressedshift = true
print("Left Shift pressed")
end
end)
userInputService.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift and pressedshift == true then
pressedshift = false
print("Left Shift released")
end
if input.KeyCode == Enum.KeyCode.C and pressedC == true then
pressedC = false
print("C/Control released")
end
end)
tiny bit late however currently Shift + C/X are new binds being used with the update for grid snapping (i think), if you want to disable it then you can unbind the hotkeys, your script will work as intended in the actual game itself, hope this helps
[edit]: sorry forgot to include this originally however you can disable them via File (in the top left of your screen), then click Studio Settings, click the Studio tab and scroll down until you see “Respect Studio shortcuts when game has focus” and disable it, that should solve your issue
edit: sorry i forgot to make that script, contact me if you still need it since the post is now solved
also i didnt see that wetro said how to disable it too that’s my fault