I found this in a script but don't know what to replace instead of "GuiService"
-- -- CHatHotKey is '/' -- GuiService:AddSpecialKey(Enum.SpecialKey.ChatHotkey) -- GuiService.SpecialKeyPressed:connect(function(key) -- if key == Enum.SpecialKey.ChatHotkey then
So I want to add that "/" character instead of this:
mouse.KeyDown:connect(function (key) -- Run function 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-
wait() local plr = Game:GetService("Players").LocalPlayer local mouse = plr:GetMouse() mouse.KeyDown:connect(function(key) print(plr.Name .. " pressed " .. key) if key == "e" then -- code end end)
mouse.KeyDown:connect(function(Key) 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