So I am basically writing a script for a player to be able to change the text of a Gui.
I want the player to be able to type, so far I have managed but I can not find a way to basically detect when the player presses Enter or Delete. I know how to program the rest when the button is pressed but when it comes to detecting it I've got no clue.
Here is the part in Global Script, It's connected through a remoteevent to a local script detecting and sending the keys pressed.
keyboards = {"--//%USERNAME:"} function Type(player, key) if key == DeleteButton then mydeletescript() else table.insert(keyboards, key) PGUIFrame.ScrollingFrame.qwerty.Text = table.concat(keyboards, "") end script.Parent.Parent.Values.keypress.OnServerEvent:Connect(Type)
Please tell me if there is a detail I forgot to mention!
An example for UserInputService: Put a LocalScript to StarterCharacterScript and write the following code into it:
game:GetService("UserInputService").InputBegan:Connect(function(input,proc) if not proc and input.KeyCode == Enum.KeyCode.Return then print("Enter pressed") -- Of course this can be changed to what you want, you can just use FireServer() from there, and it will fire only when enter is pressed end end)