i have been watching scripting videos and i do not understand when i will need to use these can someone please give me an example?
Ok, so game.Workspace.part (or whatever the part is called) is like a scripting tree, for lack of a better term, of categorization. What I mean is, game is the overall category that includes everything in the game, workspace is a category inside the game which has most of the things that you have made for the game (parts, models, even some scripts). So when you would use this is when you are trying to do something with or to a part that is located in the workspace, whether it is changing the part's properties or having something happen to is or whatever you want to do. In order to get the specific part that you want to affect in the script, you have to put game.workspace.Part (if the part's name is part). If the part that you want is called "Trees" then you would say game.workspace.Trees and then you could do whatever you want to that part. It is basically a way of getting a specific part through a script to change or do something to that part. You can also do this for other categories within the game category, such as the StarterGui section (game.StarterGui.(name of the GUI). I hope this helps, if anything is still unclear feel free to comment below and I'll try to clarify.
Basically everytime you want to reference something inside the workspace, you will use
game.Workspace.YourThingYouWantToReference
so for example, say you wanted to reference a brick inside the workspace folder with a script.
You would do this:
local variable = game.Workspace.Brick -- this is a variable, which means we have now referenced the thing you wanted to call out. --now you can do whatever you want with that variable(Brick) through a function!
So everytime you want to reference something inside the workspace folder, use game.workspace.
game = the actual game
workspace = folder inside of the game in the "Explorer" tab inside 'View' at the top of studio