Enter the names of the players on a scene

Hello or Hello again to all, :sweat_smile:

I would like to make a scene where the players can write their names on the phone but I have a problem. When Player 1 clicks on the blue square to validate his name, then his name is displayed in all the text areas :sweat:
I would like his or her name to appear in only text area number 1.

I attach two screenshots of my events and the “game” link to see the extent of the problem.

Thanks again for your reactivity :heart_eyes:

Link of “game” :
https://games.gdevelop-app.com/game-c5cfb856-380b-46b3-9c05-73ae6ab1c2e0/index.html

Are all the text areas on the scene the same object named ‘NomJoueur’? If so, the ‘Change the text…’ action will affect them all because technically it should.

You could either create separate objects for each of the text areas with different names, OR, add an instance variable to each of them to distinguish them from one another and add that in your conditions.

For example, add the instance variable WhichPlayer to each of the text areas, one with the value Player1, another with Player2, another with Player3.

Then when you want to add the name in your events sheet, add a condition that references that instance variable like so:

Add the same condition with 'Player2", “Player3” etc when you’re trying to target that text area.

Thank you for this very helpful answer! :heart_eyes:

I tried what you said but I’m stuck… I’m having trouble understanding what the problem is with that :sweat:

Sorry it’s hard for me to follow along with the french code, is it just doing the same thing or are you having different issues?

Sorry, I forgot to translate the code into English.:sweat_smile: I have just modified the photo

When I click on the button nothing happens… I don’t know if I put the line of code in the right place or if I need to move it or if I need to change other things… :disappointed_relieved:

I’m not sure I quite get the text area setup you have going here. You have just the 1 text area used for showing captured input called NomJoueur? If so, that kind of neglects the point of using/checking for the instance variables (if every text object has it’s own name.)

Let me try something over here and I’ll post back in a bit.

Let me make it easier to transfer my start of gambling to you, so that you can become more aware of the problem. :blush:
https://we.tl/t-mYUA3KRxEP

Sorry, didn’t see your post in time so tried recreating it from scratch. Anyway, see if this helps - it’s a little different but I think does what you’re trying to do.

https://we.tl/t-Q1p3xsTry0

1 Like

Hello,

That’s exactly what I’ve been trying to do for days! You just helped me take a giant step.:muscle:

Thank you so much :heart_eyes: