Example: When the players click to the C key from their keyboards their characters will lie down.
More example: F to punch ,
I really need this for lie down animation
Yes, you can use UserInputService in a LocalScript to detect player input and play an animation. UserInputService | Documentation - Roblox Creator Hub
2 Likes
where ı have to put this local script in the explorer?
Here tells you where you can put it:
So what can I do to make it work when I touch the f key for example?
You would something like this:
local UserInputService = game:GetService("UserInputService")
-- A sample function providing one usage of InputBegan
local function onInputBegan(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.F then
print("The F button has been pressed!")
end
end
UserInputService.InputBegan:Connect(onInputBegan)
2 Likes
Oh ı understand this ,
but ı have one more question left
where ı have to put this script in explorer?
Anywhere. StarterCharacter scripts most likely but others works as well.
Any of the below:
1 Like