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
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(Input,GPE)
    if not GPE then
        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

local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(Input,GPE)
    if not GPE then
        if Input.UserInputType == Enum.UserInputType.Keyboard then
        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:

local CAS = game:GetService("ContextActionService")

local function Button(actionName, inputState, inputObj)
    if inputState == Enum.UserInputState.Begin then --this will make the code only run when you press it down, so it doesn't fire twice.
    print("hi")
    end
end

--CAS:BindAction  must always be below the function in order to work

CAS:BindAction("any name here", Button, true, "q")

--the parameters needs the following in order:

--string name
--the name of the function you want it to bind
--create a button for mobile players
--key you want to bind

Answer this question