File tree Expand file tree Collapse file tree 6 files changed +23
-9
lines changed Expand file tree Collapse file tree 6 files changed +23
-9
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,9 @@ You can also combine functions inside a `Class.LocalScript|LocalScript`. For exa
113113
114114``` lua
115115local MarketplaceService = game :GetService (" MarketplaceService" )
116- local player = game .Players .LocalPlayer
116+ local Players = game :GetService (" Players" )
117+
118+ local player = Players .LocalPlayer
117119local button = script .Parent
118120
119121-- Replace the placeholder ID with your developer product ID
Original file line number Diff line number Diff line change @@ -29,11 +29,13 @@ description: |
2929 The Backpack can be accessed from both the client and the server.
3030
3131 ```lua
32+ local Players = game:GetService("Players")
33+
3234 -- Accessing Backpack from a Server Script:
33- game. Players.PlayerName.Backpack
35+ local backpack = Players.PlayerName.Backpack
3436
3537 -- Accessing Backpack from a LocalScript:
36- game. Players.LocalPlayer.Backpack
38+ local backpack = Players.LocalPlayer.Backpack
3739 ```
3840code_samples :
3941 - Backpack-Give-Tool
Original file line number Diff line number Diff line change @@ -1417,11 +1417,14 @@ events:
14171417 of the user's mouse relative to a GUI element:
14181418
14191419 ```lua
1420+ local Players = game:GetService("Players")
1421+
14201422 local CustomScrollingFrame = script.Parent
14211423 local SubFrame = CustomScrollingFrame:FindFirstChild("SubFrame")
14221424
1423- local mouse = game.Players.LocalPlayer:GetMouse()
1424- function getPosition(X, Y)
1425+ local mouse = Players.LocalPlayer:GetMouse()
1426+
1427+ local function getPosition(X, Y)
14251428 local gui_X = CustomScrollingFrame.AbsolutePosition.X
14261429 local gui_Y = CustomScrollingFrame.AbsolutePosition.Y
14271430
Original file line number Diff line number Diff line change @@ -155,6 +155,8 @@ methods:
155155 `Datatype.BrickColor` property:
156156
157157 ```lua
158+ local Players = game:GetService("Players")
159+
158160 local function paintFigure(character, color)
159161 -- Iterate over the child objects of the character
160162 for _, child in character:GetChildren() do
@@ -165,7 +167,7 @@ methods:
165167 end
166168 end
167169 end
168- paintFigure(game. Players.Player.Character, BrickColor.new("Bright blue"))
170+ paintFigure(Players.Player.Character, BrickColor.new("Bright blue"))
169171 ```
170172
171173 Since all classes inherit from `Class.Object`, calling
Original file line number Diff line number Diff line change @@ -391,9 +391,11 @@ events:
391391 player clicks while the created tool is equipped.
392392
393393 ```lua
394+ local Players = game:GetService("Players")
395+
394396 local tool = Instance.new("Tool")
395397 tool.RequiresHandle = false
396- tool.Parent = game. Players.LocalPlayer.Backpack
398+ tool.Parent = Players.LocalPlayer.Backpack
397399
398400 function onActivation()
399401 print("Tool activated")
@@ -423,9 +425,11 @@ events:
423425 player releases their click while the tool is equipped and activated.
424426
425427 ```lua
428+ local Players = game:GetService("Players")
429+
426430 local tool = Instance.new("Tool")
427431 tool.RequiresHandle = false
428- tool.Parent = game. Players.LocalPlayer.Backpack
432+ tool.Parent = Players.LocalPlayer.Backpack
429433
430434 function toolDeactivated()
431435 print("Tool deactivated")
Original file line number Diff line number Diff line change @@ -209,10 +209,11 @@ methods:
209209 text as the second argument:
210210
211211 ```lua
212+ local Players = game:GetService("Players")
212213 local LocalizationService = game:GetService("LocalizationService")
213214
214215 local success, translator = pcall(function()
215- return LocalizationService:GetTranslatorForPlayerAsync(game. Players.LocalPlayer)
216+ return LocalizationService:GetTranslatorForPlayerAsync(Players.LocalPlayer)
216217 end)
217218
218219 if success then
You can’t perform that action at this time.
0 commit comments