How to get player game

Hey,
I’m trying to make a system where there is a GUI of the player’s friends. It shows what game each of his friends are although I’m not too certain how to achieve this. I have tried:

if game.PlaceId == 123456 then

end

but, I wanna get the game name. Please help. Thanks in advance.

You can use game.Name

(30 char limit)

1 Like

Thanks! didnt think it would be this simple haha

1 Like

Pls NOT use the Name. If you change the Name of your game or another game change its name to your game name (if it was a hacker) then its not more can work. You still should use the PlaceID, ever and never use the name.

  • If you can work with numbers, then use them. Numbers never will change so it will be no risk.

But I want to get the name of the game. I cant script an if statement for every single game on Roblox. I’ve seen popular games do this. How would I go around this?

? You want the Name? Use the Name. You want use the Name for if statements? Then not use the Name but use the number

@happygeneral2015
What are you trying to achieve and why you would script an if statement for all single existing game?

I am trying to create a GUI where a player can see all of his friends and what their up to. It shows what game their playing and gives them the ability to invite them. How can I display the name of the game that they are playing (only the game name)?

First:
If you still not want to use numbers but a name, then you are out of luck:

https://developer.roblox.com/en-us/api-reference/property/DataModel/PlaceId


You NEED a int, also a number, this number is the id of your place. You can‘t use strings, also not the name of the game, this can‘t work

Second:

You need to use the social service for your project.

yes but thats not exactly what I’m looking for. (btw thanks for the tutorial, might need that later). Lets say, a friend of mine joins Prison Life. I join my game. It displays that my friend is online and shows what game he is playing. (just the name). Im trying to figure out the way to display the game name. game.Name wont work. What can i do.

Show what you tried then we can help

Ive tried:

if game.PlaceId = 123456 then
 print("the user is in the following game")
end

Although, thats not what I want. I wanna be able to get the name of any game.

Watch the tutorial, it explain all

1 Like