This may seem like a stupid question, but I started learning scripts and I need someone to explain this:
sp = script.Parent
What does this script? What mean?
In this script you are assigning the global variable sp
to the value script.Parent
.
This means that script.Parent
is the parent of the script!
We can then simply access it using the variable sp
!
What does this mean?
If you insert a script into workspace
, the parent of the script becomes workspace
!
This is because that roblox uses a hierarchy
. For more information on this click this link.
It is also important to know about global variables, and local variables, for more information, click this link.
I hope this helps, if it does, please accept!