What is difference

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!
    what should i use, game:Getservice(“Players”).LocalPlayer or game.Players.LocalPlayer

  2. What is the issue? Include screenshots / videos if possible!

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

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!

-- This is an example Lua code block

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Please use the search feature.

1 Like

As a developer, we can simply change the name of services, in case that you change the name of service ‘Players’ to something else (ie. PlayersServiceByMe), using game.Players won’t work, however, using game:GetService(“Players”) still works as usual.

Another thing is, Roblox studio won’t load all the services when you use unless you manually call it, for example, MarketplaceService, you cannot use game.MarketplaceService because it is not being automatically loaded yet when the game is loaded. If you want to use it, you have to call it by using game:GetService(“MarketplaceService”) first.

i tried but i couldn’t find so sorry

1 Like

Honestly, it’s even better this way because it’s more readable:

local Players = game:GetService("Players")

local LocalPlayer = Players.LocalPlayer

Just remember you can only access the raw LocalPlayer object on the client but not the server!