So in case you're wondering what I mean: like if a press the key "H" it would print Hello World.
Thank you, InfectedRythmCC
I suggest you reading the following articles from the wiki: https://developer.roblox.com/en-us/api-reference/event/UserInputService/InputBegan https://developer.roblox.com/en-us/api-reference/enum/KeyCode
For your example, the code would be like this: (Writen in a local script inside StarterPlayerScripts)
local UserInputService = game:GetService("UserInputService") local hotkey = "H" local message = "Hello world" function OnInputBegan(input, gameProcessed) -- Check if triggered by the keyboard if input.UserInputType == Enum.UserInputType.Keyboard then local keyPressed = input.KeyCode -- Check if the key pressed was 'hotkey' if keyPressed == Enum.KeyCode[hotkey] then print(message) end end end UserInputService.InputBegan:Connect(OnInputBegan)
local uis = game:GetService("UserInputService") uis.InputBegan:connect(function(key) if key.KeyCode == Enum.Keycode.H then print("YouTube Exists") end end)
Closed as Not Constructive by hiimgoodpack, Le_Teapots, Psudar, zblox164, SirDerpyHerp, and User#5423
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?