This is a LocalScript in it. It won't print "react" or "works" when a key is pressed. Hovering my mouse for example does print "react". Pls help. script.Parent is a TextBox.
script.Parent.InputBegan:Connect(function(input) print("react") if input.UserInputType == Enum.UserInputType.Keyboard then print("works") end end)
Thanks for helping.
Input began is the event of user input service you should've made a variable of the user input service and replace "script.Parent" in the first line with the variable, also make sure it's a local script because global scripts can't use the user input service.
So here is what i did
script.Parent.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.Keyboard then local keyPressed = input.KeyCode print("A key is being pushed down! Key:",input.KeyCode)
i used the following script with a little help from https://developer.roblox.com/api-reference/event/GuiObject/InputBegan
and then i hovered over the text box and started pressing buttons