You can Reference All services without getservice()? eg examples include workspace.TweenService workspace.["Run Service"] This makes no sense

okay i will admit i didn’t test all 150+ service to make this post but new coders are all always told things like Tween-service is a service you need this keyword to get it. which is technically wrong heck even on robloxs Coding documentation Site they lie in the first sentence saying you can not directly reference it and then go on to explain it

How can robloxs lie on their own site weird very weird

What’s confusing you about this?

All services are under game, so you can reference them like any other service. You should always be using :GetService though.

Could be outdated; a lot of services did not have their proper names (they just went by “Instance” until around 2 years ago)


I recommend using GetService as well since it avoids conflicts like this

1 Like

so basically not using get service is a sin and even though valid just trash and useless all together i always find my self using getservice()

I’ve found this topic on the DevForum, might be useful : Uses of :Getservice - #6 by Fxllen_Developer

thank you i am getting to the point where i am beginning to dig deeper and question what i know instead of just hearing other people say it’s better (which it is) i want to know WHY it’s better and if their ever is a possible case where it should not be used

1 Like

why is it better though i believe you and everything but what makes it better i want to be able to tell the people who i may teach scripting to why it’s better and the reason they should avoid standard referencing for getting services

some developers (for some reason…) rename the services
:GetService() returns the service no matter the name
also, if you were to type ‘game.TweenService’ while tweenservice hasn’t loaded, it would error.
:GetService() waits until tweenservice is loaded so it doesn’t error

It’s more reliable for a few reasons:

  1. It doesn’t rely on the Service’s name. If the name of a Service is changed or modified, using the GetService method will not affect your script
  2. Direct indexing is dangerous. If for some reason your script loads before the service has loaded in, it will error. (A few services don’t exist when the game starts). The method will create the service if it doesn’t exist
  3. This sort of ties back to the previous two points. Using GetService ensures that your script will be compatible with every game it’s in (for the aforementioned reasons)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.