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

How do I detect when a user presses the Spacebar?

Asked by
blowup999 659 Moderation Voter
10 years ago

I know how to use keys like

plr = game.Players.LocalPlayer:GetMouse()
plr.KeyDown:connect(function(key)
if key:lower()=="e" then --Can just change e
--Make something happen
end
end)

So how would I make something happen when I pressed spacebar?

2 answers

Log in to vote
1
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
10 years ago

Replace "e" with " "

Ad
Log in to vote
0
Answered by 10 years ago

You could also have the script look for the "Jump" property in a humanoid, but otherwise 1waffle1's solution should work.

Answer this question