Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

user input service not working?

Asked by 9 days ago

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. RobloxWhizYT 1852 — 9d
0
no Gameplayer365247v2 166 — 9d
0
dumb RobloxWhizYT 1852 — 9d
0
ur dumb for thinking it goes in the serverscriptservice or workspace Gameplayer365247v2 166 — 9d
View all comments (3 more)
0
read my answer that works Gameplayer365247v2 166 — 9d
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 366 — 9d
0
He didn't state that it should be in Workspace or ServerScriptService [2]. Mr_Unlucky 366 — 9d

2 answers

Log in to vote
5
Answered by 9 days ago
Edited by incapaxx 9 days 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. RobloxWhizYT 1852 — 9d
0
we cant let gamer's answer get accepted incapaxx 2925 — 9d
0
you all should upvote cuz i want next rank lol mattchew1010 310 — 9d
0
Upvote y'all because this is the best answer so far Mr_Unlucky 366 — 9d
Ad
Log in to vote
1
Answered by 9 days ago
Edited 9 days 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 166 — 9d
0
uhhhhhhhhh why not use the input parameter passed by InputBegan smh RobloxWhizYT 1852 — 9d

Answer this question