Get service||doc135765

September 20, 2022

Format

 Game.GetService(name) 
  • The class to which the function belongs:Game

Description

Get the corresponding service instance of the specific class name, if you access the non-existing service code, a warning will occur.


Parameters

Variable name type Description
name string service name


Value Returned

type Description
Instance Returns the requested service instance


Code Samples

For example, to obtain a payment service

local PayHelper = Game.GetService("PayHelper")