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

How Can I Use Keybind Functions? [Solved] [closed]

Asked by 5 years ago
Edited 5 years ago

So when a certain button on your keyboard is pressed I want it to run a certain script. In this case I am making a game where when you press a button on your keyboard it will run the script below it. I already have the script below it typed so all I need is the first line.

alert "CheckeredDev" + " is awesome but needs help scripting xD!";
0
Your question is very vague. Nickuhhhhhhhhhhhhhhh 834 — 5y
1
That doesn't seem to make any difference except the fact of misunderstanding my conception NotFrindow 346 — 5y
0
Yes and the point of you posting this here was so we could help you, we can't help you if we can't understand what your saying. Nickuhhhhhhhhhhhhhhh 834 — 5y
1
I'm saying is there a LINE OF CODE that can make it so it will run a script NotFrindow 346 — 5y
0
No attempt has been made and code provided is in another language and doesn't solve the problem anyways. hiimgoodpack 2009 — 5y

Closed as Not Constructive by hiimgoodpack and royaltoe

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
1
Answered by
Omzure 94
5 years ago

This might not be what you mean but here:

Make sure API services are enabled

local UserInputService = game:GetService("UserInputService")
local Key = 'Z' -- change 'Z' to the key you want to press
UserInputService.InputBegan:Connect(function(Input, IsTyping)
    if IsTyping then return end
    if Input.KeyCode == Enum.KeyCode[Key] then
        --script here
    end
end)

0
API Services are enabled? Nickuhhhhhhhhhhhhhhh 834 — 5y
0
if API Services aren't enabled, your whole script won't work, so you gotta make sure it's enabled for your script to work. In case you don't know how to enable: ||||| 1: Go to the games page 2: click the little cog next to the game 3: click 'edit game' 4: enable API ||||| Omzure 94 — 5y
1
Yeah... I don't need to know how to turn on API services... I have been programming since 2015 NotFrindow 346 — 5y
Ad