RobloxLocked (Property): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>JulienDethurens Instance::Remove is deprecated; changing to Instance::Destroy. |
>JulienDethurens No edit summary |
||
Line 4: | Line 4: | ||
|name = RobloxLocked | |name = RobloxLocked | ||
|protected = yes | |protected = yes | ||
| | |type = {{type|bool}} | ||
|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. | ||
|object = Instance | |object = Instance | ||
Line 11: | Line 11: | ||
{{clear floats}} | {{clear floats}} | ||
{{Example|If using the [[Command Bar]] or a [[CoreScript]]...< | {{Example|If using the [[Command Bar|command bar]] or a [[CoreScript]]...<code lua> | ||
Workspace.Part.RobloxLocked = true -- sets the Part's RobloxLocked to true</code> | |||
If using a [[Script]] or [[LocalScript]]...< | If using a [[Script]] or [[LocalScript]]...<code lua> | ||
Workspace.Part.RobloxLocked = true --> Unknown exception</code>}} | |||
==RobloxLocked doesn't get saved== | ==RobloxLocked doesn't get saved== | ||
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]]. There are, however, some objects that are RobloxLocked by default. | Therefore, you can set an object's [[RobloxLocked (Property)|RobloxLocked]] property 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]]:< | {{Example|[[Command Bar]]:<code lua> | ||
Workspace.Part.RobloxLocked = true | Workspace.Part.RobloxLocked = true | ||
print( Workspace.Part.RobloxLocked ) --> true</ | print( Workspace.Part.RobloxLocked ) --> true</code> | ||
[[Script]]:< | [[Script]]:<code lua> | ||
script.Parent = Workspace.Part -- does not error because RobloxLocked is false by default for this object | script.Parent = Workspace.Part -- does not error because RobloxLocked is false by default for this object | ||
script.Parent = game.CoreGui --> Unknown exception | script.Parent = game.CoreGui --> Unknown exception | ||
--Errors because CoreGui has RobloxLocked set to true by default</ | --Errors because CoreGui has RobloxLocked set to true by default</code>}} | ||
==RobloxLocked-ness is inherited== | ==RobloxLocked-ness is inherited== | ||
This means that if Workspace.RobloxLocked is true, then everything in the Workspace will act as if it was RobloxLocked. | This means that if Workspace.RobloxLocked is true, then everything in the Workspace will act as if it was RobloxLocked. | ||
{{Example|[[Script]]:< | {{Example|[[Script]]:<code lua> | ||
game.CoreGui.RobloxGui:Destroy() -- nope</ | game.CoreGui.RobloxGui:Destroy() -- nope</code> | ||
[[Command Bar]]:< | [[Command Bar]]:<code lua> | ||
game.CoreGui.RobloxGui.RobloxLocked = false</ | game.CoreGui.RobloxGui.RobloxLocked = false</code> | ||
[[Script]]:< | [[Script]]:<code lua> | ||
game.CoreGui.RobloxGui:Destroy() -- still no</ | game.CoreGui.RobloxGui:Destroy() -- still no</code> | ||
[[Command Bar]]:< | [[Command Bar]]:<code lua> | ||
game.CoreGui.RobloxLocked = false</pre> | game.CoreGui.RobloxLocked = false</pre> | ||
[[Script]]:< | [[Script]]:<code lua> | ||
game.CoreGui.RobloxGui:Destroy() -- Yes!</ | game.CoreGui.RobloxGui:Destroy() -- Yes!</code>}} | ||
[[Category:Properties]] | [[Category:Properties]] |
Revision as of 21:42, 12 February 2012
Protected:This item is protected. Attempting to use it in a Script or LocalScript will cause an error.
RobloxLocked | |
Type | bool |
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
{{{1}}}
RobloxLocked doesn't get saved
Therefore, you can set an object's RobloxLocked property 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
{{{1}}}
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
{{{1}}}