RobloxLocked (Property): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>Camoy No edit summary |
>Legend26 Some grammar errors fixed, cleared a few things up, and changed the code to non camelCase |
||
Line 11: | Line 11: | ||
game.Workspace.Part.RobloxLocked = true -- sets the Part's RobloxLocked to true</pre> | game.Workspace.Part.RobloxLocked = true -- sets the Part's RobloxLocked to true</pre> | ||
If using a [[Script]] or [[LocalScript]]...<pre> | If using a [[Script]] or [[LocalScript]]...<pre> | ||
game.Workspace.Part.RobloxLocked = true --> | game.Workspace.Part.RobloxLocked = true --> Unknown exception</pre>}} | ||
==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]]. | 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. | ||
{{Example|[[Command Bar]]:<pre> | {{Example|[[Command Bar]]:<pre> | ||
Workspace.Part.RobloxLocked = true | Workspace.Part.RobloxLocked = true | ||
Line 21: | Line 21: | ||
print( Workspace.Part.RobloxLocked ) --> true</pre> | print( Workspace.Part.RobloxLocked ) --> true</pre> | ||
[[Script]]:<pre> | [[Script]]:<pre> | ||
script.Parent = Workspace.Part -- | script.Parent = Workspace.Part -- does not error because RobloxLocked is false by default for this object | ||
script.Parent = game.CoreGui --> | script.Parent = game.CoreGui --> Unknown exception | ||
--Errors because CoreGui has RobloxLocked set to true by default</pre>}} | |||
==RobloxLocked-ness is inherited== | ==RobloxLocked-ness is inherited== | ||
This means that if Workspace.RobloxLocked | This means that if Workspace.RobloxLocked is true, then everything in the Workspace will act as if it was RobloxLocked. | ||
{{Example|[[Script]]:<pre> | {{Example|[[Script]]:<pre> | ||
game.CoreGui.RobloxGui: | game.CoreGui.RobloxGui:Remove() -- nope</pre> | ||
[[Command Bar]]:<pre> | [[Command Bar]]:<pre> | ||
game.CoreGui.RobloxGui.RobloxLocked = false</pre> | game.CoreGui.RobloxGui.RobloxLocked = false</pre> | ||
[[Script]]:<pre> | [[Script]]:<pre> | ||
game.CoreGui.RobloxGui: | game.CoreGui.RobloxGui:Remove() -- still no</pre> | ||
[[Command Bar]]:<pre> | [[Command Bar]]:<pre> | ||
game.CoreGui.RobloxLocked = false</pre> | game.CoreGui.RobloxLocked = false</pre> | ||
[[Script]]:<pre> | [[Script]]:<pre> | ||
game.CoreGui.RobloxGui: | game.CoreGui.RobloxGui:Remove() -- Yes!</pre>}} | ||
[[Category:Properties]] | [[Category:Properties]] |
Revision as of 20:34, 8 July 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 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!