Players = game.Players.LocalPlayer
mouse = Players:GetMouse()
mouse.KeyDown:connect(function(key)
if key == "h" then
print ("h")
end
end)?
I haven't used roblox studio in a while. But I do remember this being able to work.
Players = game.Players.LocalPlayer
mouse = Players:GetMouse()
mouse.KeyDown:connect(function(key)
if key == "h" then
print ("h")
end
end)?
I haven't used roblox studio in a while. But I do remember this being able to work.
I think your problem is the "h", as from what I know keybites were specific numbers that you used, not letters.
But might I recommend UserInputService? KeyDown is outdated, and this is the best way to do it. Put this in a LocalScript:
local player = game.Players.LocalPlayer
local userInputService = game:GetService("UserInputService")
userInputService.InputBegan:connect(function(userInput)
if userInput.UserInputType == Enum.UserInputType.Keyboard then
if userInput.KeyCode == Enum.KeyCode.H then --Make sure the Enum.KeyCode is before the character.
print'h down'
end
end
end)
userInputService.InputEnded:connect(function(userInput)
if userInput.UserInputType == Enum.UserInputType.Keyboard then
if userInput.KeyCode == Enum.KeyCode.H then
print'h up'
end
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
http://wiki.roblox.com/index.php?title=API:Class/UserInputService
idk there is a question mark at the end so I guess remove it?
and make sure you are using a local script?
the question is a mistake here on the website it is not like that on studio