Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I detect if a player pressed space using a local script? [closed]

Asked by 5 years ago

How do I detect if a player pressed space using a local script?

Closed as Not Constructive by User#19524

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 5 years ago

Use userinput service

UIS = game:GetService('UserInputService')

UIS.InputBegan:connect(function(input)
    if input.KeyCode == Enum.KeyCode.Space then
        --code
    end
end)

0
I would put the local script under starterGui starterpack or starter player scripts NYDynamics 71 — 5y
0
It doesn't work but doesn't show any errors in the output FirezoneGamez 155 — 5y
Ad