I found this in a script but don't know what to replace instead of "GuiService"
1 | -- -- CHatHotKey is '/' |
2 | -- GuiService:AddSpecialKey(Enum.SpecialKey.ChatHotkey) |
3 | -- GuiService.SpecialKeyPressed:connect(function(key) |
4 | -- if key == Enum.SpecialKey.ChatHotkey then |
So I want to add that "/" character instead of this:
1 | mouse.KeyDown:connect( function (key) -- Run function |
2 | if key = = "e" then |
GuiService
is inaccessible to scripts created by users. If you're trying to detect keyboard input, I'd put a LocalScript
inside of StarterGui with this code-
01 | wait() |
02 | local plr = Game:GetService( "Players" ).LocalPlayer |
03 | local mouse = plr:GetMouse() |
04 |
05 | mouse.KeyDown:connect( function (key) |
06 | print (plr.Name .. " pressed " .. key) |
07 | if key = = "e" then |
08 | -- code |
09 | end |
10 | end ) |
1 | mouse.KeyDown:connect( function (Key) |
2 | if key:byte() = = 37 then -- 37 is the number code for "/" |
You can find more number codes here: http://wiki.roblox.com/index.php/Taking_keyboard_input