How to input numbers in game? [SOLVED]

I want to be able to ask for an input when a button is pressed:

When button pressed
Ask for input
Set Variable to [Input]

You can add new condition
In search bar type OR and add it
Under OR put

0 key pressed
1 key pressed
2 key pressed
3 key pressed
4 key pressed
5 key pressed
6 key pressed
7 key pressed
8 key pressed
9 key pressed

Trigger once

In action
Change variable ADD LastKeyPressed()

ok but what if i wanted to do it on mobile?

oh wait I could make buttons myself

@ZeroX4 NOT WORKING

Its ToNumber(LastPressedKey())

You could use a text input object, which will bring up the device keyboard when selected. Or, make a custom number pad to display when needed

STILL NOT WORKING


also i want it to be string

Try closely reading the error messages you get before just claiming that “it doesn’t work”:

Cannot find an expression with this name: LastKeyPressed

This is because the function is called “LastPressedKey”, not “LastKeyPressed”

1 Like

Where did i write ToString?



WHY

If you are using text variable then top one
If number variable then bottom one

You siad you want only numbers
So you should have number variable and use ToNumber()

never mind i found a way that works