Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What does :GetService() do exactly in code?

Asked by 4 years ago
Edited 4 years ago

What does game:GetService() do. Ive read that :GetService() gets a service just like its name but I never understood how it works. I used it in

https://education.roblox.com/en-us/resources/intro-to-coding-coding-3-creating-a-point-giving-part

to make the point giving Part but when I removed it the code still works normally. Can someone explain to me what It does and give some examples? Thank You

0
Well, on the client, if your trying to use UserInputService i believe you have to use GetService. If you do game.UserInputService you get the UserInputService is not a valid member of DataModel error mybituploads 304 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

game:GetService("Workspace") are basically the same as game.Workspace, but some service cannot use that way (game.Workspace) most script-er recommended using game:GetService() except for workspace.

local Workspace = game:GetService("Workspace") -- is the same as
local workspace = game.Workspace

Hope my badly made answer helped

0
Helped a lot Thanks JustinWe12 723 — 4y
Ad

Answer this question