Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

1 answer

Use userinput service

UIS = game:GetService('UserInputService')

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

2 comments

0

I would put the local script under starterGui starterpack or starter player scripts

0

It doesn't work but doesn't show any errors in the output

This discussion is preserved as it was. New answers, comments, and votes are closed.