RobloxLocked (Property): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>Legend26 No edit summary |
>Legend26 No edit summary |
||
Line 1: | Line 1: | ||
{{protected}} | |||
<onlyinclude>{{Property | <onlyinclude>{{Property | ||
|name = RobloxLocked | |name = RobloxLocked | ||
|protected = yes | |||
|property = [[Bool]] ''RobloxLocked'' | |property = [[Bool]] ''RobloxLocked'' | ||
|description = If true, the object and its descendants cannot be indexed or edited by a [[Script]] or [[LocalScript]] and will throw an error if it is attempted. | |description = If true, the object and its descendants cannot be indexed or edited by a [[Script]] or [[LocalScript]] and will throw an error if it is attempted. |
Revision as of 05:15, 6 January 2012
Protected:This item is protected. Attempting to use it in a Script or LocalScript will cause an error.
RobloxLocked | |
Property | Bool RobloxLocked |
Description | If true, the object and its descendants cannot be indexed or edited by a Script or LocalScript and will throw an error if it is attempted. |
Member of | Instance |
Example
If using the Command Bar or a CoreScript...game.Workspace.Part.RobloxLocked = true -- sets the Part's RobloxLocked to trueIf using a Script or LocalScript...
game.Workspace.Part.RobloxLocked = true --> Unknown exception
RobloxLocked doesn't get saved
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. There are, however, some objects that are RobloxLocked by default.
Example
Command Bar:Workspace.Part.RobloxLocked = true print( Workspace.Part.RobloxLocked ) --> trueScript:
script.Parent = Workspace.Part -- does not error because RobloxLocked is false by default for this object script.Parent = game.CoreGui --> Unknown exception --Errors because CoreGui has RobloxLocked set to true by default
RobloxLocked-ness is inherited
This means that if Workspace.RobloxLocked is true, then everything in the Workspace will act as if it was RobloxLocked.
Example
Script:game.CoreGui.RobloxGui:Remove() -- nopeCommand Bar:
game.CoreGui.RobloxGui.RobloxLocked = falseScript:
game.CoreGui.RobloxGui:Remove() -- still noCommand Bar:
game.CoreGui.RobloxLocked = falseScript:
game.CoreGui.RobloxGui:Remove() -- Yes!