Hello, just a quick question what I would you to answer please c;
I have used scripts mainly using things like this: game.Workspace.Part.SpotLight.Enabled = true. what work fine.
But sometimes I can't get some things like game.Workspace.Something.Something to work. Therefore turning to script.Parent.Parent.Something.Something. Therefore making it work o-o
Can you please tell me the difference? :D
Thanks, Mc.
It all depends on what you want, I can't really think of a correct way to answer this but let me make a few examples!
Pretend there is a script within a part, you want to access the part property's. So in this example we are going to change the transparency of the part.
script.Parent.Transparency = 0.5
This is a short cut from going:
game.Workspace.Part.Transparency = 0.5
It really depends, in Lua you !NEED! to make short cuts to make your life much more easy.
If you're in a game script in Workspace and you need to access a part (That you will be accessing regularly), you can make 'Variables' example:
Part = game.Workspace.Part Part.Transparency = 0.5
I wont get into Local Variables.
I hope this helped.