HOW TO MAKE CROUCH Button? Like Ctrl to crouch or click to crouch?
HOW TO MAKE CROUCH Button? Like Ctrl to crouch or click to crouch?
1 answer
As this site is for only fixing scripts, we can not make an animation or a whole script for you. But I am gonna do you a favor and tell how to fire the animation. Note: I am not gonna tell how to make the animation work, I am just going to tell you how you can check if some key is pressed.
Create a LocalScript (this is not a request site so I am not going to tell you were to place it, you can find on YouTube). Type this in it:
UserInputService = game:GetService("UserInputService") -- Giving a variable of UserInputService
UserInputService.InputBegan:Connect(function(input, GPE) -- When some key is pressed, the code will fire
if input.KeyCode == Enum.KeyCode.LeftControl then -- Checks if the pressed key is LeftControl
print("Pressed LeftControl") -- To check if it will fire when LeftControl is pressed
end
end)
If you want to make it possible to print it by pressing both controls, then this will work:
UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(input, GPE)
if input.KeyCode == Enum.KeyCode.LeftControl or input.KeyCode == Enum.KeyCode.RightControl then
print("Pressed a control key.")
end
end)
Remember, if you really do not know to code anything, I helped you a lot in this case. This is not a requesting site and that is why we can't directly give you the code nor where to place it.
This discussion is preserved as it was. New answers, comments, and votes are closed.

5 comments
this isnt a request site. :/
Here’s a YouTube tutorial: https://youtu.be/hR04OsrUZmE
Add me on discord and I can personally help. cass#6295
@Hydrogyn He isn't requesting, he is asking how to do it.
He indeed is requesting the whole code with the animation and stuff @DesertusX