✓ Accepted answer
GetService() is a DataModel, or game, function that prompts the game to get the service you are requesting. Generally, the game doesn't have services visible in the explorer such as UserInputService, BadgeService, or PointsService (just to name a couple) and does not have them accessible to the game by default. What GetService will do is get the service that can't easily be referenced or gets the already existing service.
Back to the service that can not easily be referenced note, that is a strong suit for GetService. Back when FilteringEnabled wasn't widely used and exploits were strongly prominent, the GetService function would end up saving the running scripts. There would be exploits that would change the names of Services and, for those that relied on the service names like Players, Workspace, or Lighting not changing, scripts could still end up running when not referenced earlier in the script.
With FilteringEnabled and Roblox implemented exploit protections, the need to use GetService on services like the few I have mentioned in the last paragraph is not strongly required but is still recommended nonetheless to avoid conflict.
######Hopefully this answered your question and if it did don't forget to hit the answer button. If you have any other questions, feel free to leave them in the comments.
1 comment
This is not a spoon feed site