I just want the gui to appear when I press "c" This is in a local script.
player = game.Players.LocalPlayer
function onKeyDown(key)
key:lower()
if key == "c" then
player.PlayerGui.Interface.Statistics.Visible = true
end
end
I just want the gui to appear when I press "c" This is in a local script.
player = game.Players.LocalPlayer
function onKeyDown(key)
key:lower()
if key == "c" then
player.PlayerGui.Interface.Statistics.Visible = true
end
end
You should be using user input service with everything you do that relates to that.
game:GetService("UserInputService").InputBegan:connect(function(input,proc) --we get the userinput service. we need proc to start it from activating while chatting
if input.KeyCode == Enum.KeyCode.C then
--STUFF HERE
end
end)
--Also you can change input began to input end for ending inputs.
if this helped your welcome :D ~KIHeros (oh and please (upvote and) accept :P)
The reason it didn't work:
You needed to call the function.
local player = game.Players.LocalPlayer
local mouse = p:GetMouse()
-- your func
mouse.KeyDown:connect(onKeyDown)
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
your answer works but KeyDown is depreciated so use UIS
Ik, but I answered his question, not give him him a completely different event lol.