Help getting the name of the game using scripts

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I am making a loading screen for my games and I want to add the game’s name inside of it

  2. What is the issue? Include screenshots / videos if possible!
    When using game.Name on local scripts, it returns “Ugc” and on server scripts returns simply “Game”

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried waiting for the game to be loaded, print the name, wait 5 seconds and print it again, it still doesn’t return the game’s name. I have tried looking for solutions but the best I could find was how you can get the game’s name with game.Name

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

here’s the code i am using (it’s a local script)

Original:

wait(game:IsLoaded())
script.Parent.Text = game.Name
script:Destroy()

Debugging:

wait(game:IsLoaded())
print("Game name: " ..game.Name)
script.Parent.Text = game.Name
wait(5)
print("Game name: " ..game.Name)
script:Destroy()

:wave: Hello there!

Look, I use the MarketplaceService to get with certainty the name of the game, here is a piece that I use to get the name of the game

local MarketplaceService = game:GetService("MarketplaceService")
local placeId = game.PlaceId

local success, placeInfo = pcall(function()
	return MarketplaceService:GetProductInfo(placeId)
end)

if success then
	local placeName = placeInfo.Name

	print(placeName)
else
	print("Error on getting data from this game") -- Sometimes it happens that roblox services go down, so I use this to know if something went wrong.
end

thanks man, I didn’t expect to have to use marketplace service while on the forums and stuff it just said to use game.Name, thanks a lot!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.