|
| 19 Apr 2013 05:42 PM |
Difference between:
game:GetService("Lighting") (AND) game.Lighting
|
|
|
| Report Abuse |
|
|
|
| 19 Apr 2013 05:48 PM |
Some services need GetService in order to be accessed
I think the ContentProvider service is one of them
And that's it
~Kill The Clones is the best game on ROBLOX!~ |
|
|
| Report Abuse |
|
|
|
| 19 Apr 2013 05:50 PM |
Also, GetService returns the service even if it's been renamed.
~ Dekkonot ~ |
|
|
| Report Abuse |
|
|
| |
|
woot3
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 3599 |
|
|
| 19 Apr 2013 06:49 PM |
| Unless there is Service in the name, I generally don't use :GetService() |
|
|
| Report Abuse |
|
|
|
| 19 Apr 2013 06:59 PM |
| I always use GetService for everything, even players. After discovering that localscripts run before they're even descendants of the game, I'm kind of paranoid about everything. |
|
|
| Report Abuse |
|
|
Aerideyn
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 1882 |
|
|
| 20 Apr 2013 12:15 AM |
as for local scripts i normaly just go:
repeat wait() until game.Players.LocalPlayer.Character
Because by the time the character is loaded - you are pretty safe to do what you like. |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2013 12:22 AM |
| I _always_ use GetService, save for the special case of Workspace which is already a variable in the default environment. |
|
|
| Report Abuse |
|
|
coplox
|
  |
| Joined: 07 Jun 2008 |
| Total Posts: 3252 |
|
|
| 20 Apr 2013 12:36 AM |
| I always use GetService as well. Because I'm obsessed with my scripts working even in certain uncommon circumstances. |
|
|
| Report Abuse |
|
|
nairod7
|
  |
| Joined: 26 Mar 2010 |
| Total Posts: 869 |
|
|
| 20 Apr 2013 07:21 AM |
@Aerideyn Game.Players.LocalPlayer.CharacterAdded:wait() -- why not this instead? :o
@coplox Soooo true :o
|
|
|
| Report Abuse |
|
|
itunes89
|
  |
| Joined: 19 Jan 2011 |
| Total Posts: 1957 |
|
|
| 20 Apr 2013 07:27 AM |
@ Aerideyn I use the same thing.
@nairod7 That works? Hmm, I'll try it. |
|
|
| Report Abuse |
|
|
woot3
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 3599 |
|
|
| 20 Apr 2013 07:46 AM |
>@Aerideyn >Game.Players.LocalPlayer.CharacterAdded:wait() -- why not this instead? :o
What if the Character already exists? |
|
|
| Report Abuse |
|
|
Quenty
|
  |
| Joined: 03 Sep 2009 |
| Total Posts: 9316 |
|
|
| 20 Apr 2013 07:50 AM |
I do this to make sure the character exists:
if not Character then Players.LocalPlayer.CharacterAdded:wait() end
Annoying even more is the fact that PlayerGui doesn't exist in other Players if you're localside, only your own player - but is visible in the server.
After a few rounds of infinite yields, I figured this out. -__-
Pretty much, I don't trust anything in ROBLOX to be there that a user can conceivable change, or the admins can (that is, will) change. My scripts generate a lot of their stuff, and depend upon a client script to send it to them for the rest. :D
AKA Don't trust ROBLOX |
|
|
| Report Abuse |
|
|
nairod7
|
  |
| Joined: 26 Mar 2010 |
| Total Posts: 869 |
|
|
| 20 Apr 2013 07:51 AM |
adahell...
local player = Game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:wait()
>.<... |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2013 11:10 AM |
Totally OT, Need help: http://www.roblox.com/Forum/ShowPost.aspx?PostID=95209119 |
|
|
| Report Abuse |
|
|
coplox
|
  |
| Joined: 07 Jun 2008 |
| Total Posts: 3252 |
|
|
| 20 Apr 2013 12:16 PM |
You know, that's one of my bad habits. When I handle a part, I always think "What if the part was removed RIGHT NOW via some skid"
So I need to realise that it doesn't matter if my game breaks when a skid invades, it just needs to work normally. |
|
|
| Report Abuse |
|
|
dekkonot
|
  |
| Joined: 22 Dec 2010 |
| Total Posts: 6685 |
|
|
| 20 Apr 2013 12:30 PM |
function waitForProp(obj, prop) repeat wait() until obj[prop] return obj[prop] end
waitForProp(game:GetService("Players"), "LocalPlayer") waitForProp(game:GetService("Players").LocalPlayer, "Character")
~ Dekkonot ~ |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2013 12:45 PM |
or...
player.CharacterAdded:wait() |
|
|
| Report Abuse |
|
|
dekkonot
|
  |
| Joined: 22 Dec 2010 |
| Total Posts: 6685 |
|
|
| 20 Apr 2013 12:48 PM |
| ._. That works too, I guess. |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2013 02:26 PM |
I've had issues in the past with CharacterAdded.
The snippet `local Character = Player.Character or Player.CharacterAdded:wait()` would, in theory, be the perfect solution. I used it quite often, but started encountering issues where the thread would yield indefinitely due to a brief moment of time before the Character property has been set, but after the script runs. The Character would not be found, and the event would not fire for some reason. Adding a `Wait(1)` to the top of the script did fix this, but I find that to be extraordinarily ugly. |
|
|
| Report Abuse |
|
|
HEAT507
|
  |
| Joined: 31 Aug 2012 |
| Total Posts: 429 |
|
|
| 20 Apr 2013 03:20 PM |
users=game:service'Players'; userl=users.localPlayer; userl.characterAdded:wait(); |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2013 05:35 PM |
| My questions have been answered. This forum has officially gained adhd. |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 20 Apr 2013 05:46 PM |
| GetService will not work for JointsService |
|
|
| Report Abuse |
|
|
dekkonot
|
  |
| Joined: 22 Dec 2010 |
| Total Posts: 6685 |
|
|
| 20 Apr 2013 06:36 PM |
That's most likely because it's not *technically* a service.
~ Dekkonot ~ |
|
|
| Report Abuse |
|
|
Voxility
|
  |
| Joined: 15 Apr 2013 |
| Total Posts: 584 |
|
|
| 20 Apr 2013 09:25 PM |
| I like to use a deprecated service ':service' instead of ':GetService' because its shorter :s. |
|
|
| Report Abuse |
|
|