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

bruh this is so dum and ugh?

Asked by 4 years ago
1local UIS = game:GetService("UserInputService")
2UIS.InputBegan:Connect(function(Input,GPE)
3    if not GPE then
4        if Input.KeyCode == Enum.KeyCode.Q then

it shows a error that the input object has no keycode? wtf.

0
if u want the full script i could post it TheUltimateTNTFriend 109 — 4y
0
put the full script its the only way CandyWreckEpicness 115 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

try this and tell me if it works

1local UIS = game:GetService("UserInputService")
2UIS.InputBegan:Connect(function(Input,GPE)
3    if not GPE then
4        if Input.UserInputType == Enum.UserInputType.Keyboard then
5        if Input.KeyCode == Enum.KeyCode.Q then
0
sorry for ur trouble i managed to figure it myself but thanks for trying to help anyway TheUltimateTNTFriend 109 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

if you're not trying to make anything too advanced, i would recommend using ContextActionService, it's a bit more simple, and your keycode won't run if you're typing in chat.

example:

01local CAS = game:GetService("ContextActionService")
02 
03local function Button(actionName, inputState, inputObj)
04    if inputState == Enum.UserInputState.Begin then --this will make the code only run when you press it down, so it doesn't fire twice.
05    print("hi")
06    end
07end
08 
09--CAS:BindAction  must always be below the function in order to work
10 
11CAS:BindAction("any name here", Button, true, "q")
12 
13--the parameters needs the following in order:
14 
15--string name
16--the name of the function you want it to bind
17--create a button for mobile players
18--key you want to bind

Answer this question