RobloxLocked (Property): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Blocco
No edit summary
>ArceusInator
added three examples of RobloxLocked -- easily one of the most, if not THE most, in-depth property page.
Line 7: Line 7:
|object      = Instance
|object      = Instance
}}</onlyinclude>
}}</onlyinclude>
{{Example|If using the [[Command Bar]] or a [[CoreScript]]...<pre>
game.Workspace.Part.RobloxLocked = true -- sets the Part's RobloxLocked to true</pre>
If using a [[Script]] or [[LocalScript]]...<pre>
game.Workspace.Part.RobloxLocked = true --> s RobloxLocked</pre>}}
==RobloxLocked has no effect if it's not assigned when the game starts==
Therefore, you can set an object's [[RobloxLocked (Property)|RobloxLocked]] to true, but unless you found some way to do that with a [[CoreScript]] at the start of the game, you will still be able to access the object from a [[Script]] or [[LocalScript]].
{{Example|[[Command Bar]]:<pre>
Workspace.Part.RobloxLocked = true
print( Workspace.Part.RobloxLocked ) --> true</pre>
[[Script]]:<pre>
script.Parent = Workspace.Part -- works because RobloxLocked was no default true
script.Parent = game.CoreGui --> s Parent</pre>}}
==RobloxLocked-ness is inherited==
This means that if Workspace.RobloxLocked==true, then everything in the Workspace will act as if it was RobloxLocked.
{{Example|[[Script]]:<pre>
game.CoreGui.RobloxGui:remove() -- nope</pre>
[[Command Bar]]:<pre>
game.CoreGui.RobloxGui.RobloxLocked = false</pre>
[[Script]]:<pre>
game.CoreGui.RobloxGui:remove() -- still no</pre>
[[Command Bar]]:<pre>
game.CoreGui.RobloxLocked = false</pre>
[[Script]]:<pre>
game.CoreGui.RobloxGui:remove() -- Yes!</pre>}}


[[Category:Properties]]
[[Category:Properties]]

Revision as of 13:56, 6 January 2011

RobloxLocked
Property Bool RobloxLocked
Description Sets whether the object and its descendants can be indexed or edited by code with a security context level below 4.
Member of Instance








Example
If using the Command Bar or a CoreScript...
game.Workspace.Part.RobloxLocked = true -- sets the Part's RobloxLocked to true
If using a Script or LocalScript...
game.Workspace.Part.RobloxLocked = true --> s RobloxLocked


RobloxLocked has no effect if it's not assigned when the game starts

Therefore, you can set an object's RobloxLocked to true, but unless you found some way to do that with a CoreScript at the start of the game, you will still be able to access the object from a Script or LocalScript.

Example
Command Bar:
Workspace.Part.RobloxLocked = true

print( Workspace.Part.RobloxLocked ) --> true
Script:
script.Parent = Workspace.Part -- works because RobloxLocked was no default true

script.Parent = game.CoreGui --> s Parent


RobloxLocked-ness is inherited

This means that if Workspace.RobloxLocked==true, then everything in the Workspace will act as if it was RobloxLocked.

Example
Script:
game.CoreGui.RobloxGui:remove() -- nope
Command Bar:
game.CoreGui.RobloxGui.RobloxLocked = false
Script:
game.CoreGui.RobloxGui:remove() -- still no
Command Bar:
game.CoreGui.RobloxLocked = false
Script:
game.CoreGui.RobloxGui:remove() -- Yes!