Still have questions? Join our Discord server and get real time help.
0

# user input service not working?

For some reason user input service is not working for me, I just started to learn about this so i know next to nothing about it, but i've watched alot of tutorials, copying there code that makes it so if i press A, the output will say you pressed A. And i even went to the roblox dev hub, and copied the code straight from there, and its still not working, What am i doing wrong?

0
1. Use it in a LocalScript and make sure the LocalScript is not in either Workspace or ServerScriptService. BashCaster 2170 — 3mo
0
no Gameplayer365247v2 551 — 3mo
0
dumb BashCaster 2170 — 3mo
0
ur dumb for thinking it goes in the serverscriptservice or workspace Gameplayer365247v2 551 — 3mo
0
0
Lmao, he has way more reputation than you, not to mention you posted an answer in https://scriptinghelpers.org/questions/78987/how-to-disable-the-jumping-while-inside-a-vehicledrive-seat stating that the reason why his code wasn't working was because he forgot to put a SPACE. And finally, he said that you should make sure that the LocalScript ins't in the Workspace or ServerScriptService. [1] Mr_Unlucky 974 — 3mo
0
He didn't state that it should be in Workspace or ServerScriptService [2]. Mr_Unlucky 974 — 3mo

5
Edited by incapaxx 3 months ago

iv'e never seen the thing that gamer posted so here's what i do:

local uis = game:GetService("UserInputService") -- get the service

uis.InputBegan:Connect(funtion(Input) --calls the function when anything is pressed
if Input.KeyCode == Enum.KeyCode.A then --check if the keycode is A this is case sensitive in other words make sure your caps are correct
print("A was pressed")
end
end)

0
Thank you. That's a lot better. BashCaster 2170 — 3mo
0
we cant let gamer's answer get accepted incapaxx 3361 — 3mo
0
you all should upvote cuz i want next rank lol mattchew1010 351 — 3mo
0
Upvote y'all because this is the best answer so far Mr_Unlucky 974 — 3mo
1
Edited 3 months ago

make sure its a local script and is in the starterpack after that for userinputservice to work u need the line

 if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.key here) then
--function here
end

0
also make sure there is no gui in the starterpack or they wont work, i had it there for some reason once and nothing from starterpack worked at that point Gameplayer365247v2 551 — 3mo
0
uhhhhhhhhh why not use the input parameter passed by InputBegan smh BashCaster 2170 — 3mo