Check if script can change property

I’m currently using ReflectionService to obtain an instance’s properties before attempting to change them if the script has the ability to write to them. There does not seem to be a way to know if my current script has the ability to do that or not.

I’ve been attempting to use SecurityCapabilities.fromCurrent():Contains() to see if the script has the capabilities to write to the properties, however, when Sandboxed is not toggled, SecurityCapabilities.fromCurrent() returns a SecurityCapabilities that contains all capabilities up to CapabilityControl (which is the highest capability there is excluding RobloxEngine and InternalTest).

Thats obviously not true since if I actually tried to write to a property that requires CapabilityControl, it would error

Also if anyone could confirm or deny this, is SecurityCapabilities.fromCurrent() actually supposed to return a SecurityCapabilities that contains CapabilityControl on any non-Sandboxed scripts? (the command line as well) This doesnt feel like intended behaviour since its obviously not accurate to the actual capabilities of whatever script it runs in but theres literally no documentation for SecurityCapabilities so I can’t tell for sure.

(Error that happens when attempting to change a property that the script lacks capabilities over)
Screen Shot 2025-12-25 at 12.32.46 PM

The result of printing SecurityCapabilities.fromCurrent() literally anywhere that isnt sandboxed
Screen Shot 2025-12-25 at 12.33.25 PM

Currently working around this by manually calling :Remove to remove the capabilities that shouldnt exist (I could’ve also created a blank SecurityCapabilities and added each capability manually but theres 20 of them so that would’ve been annoying)

local capabilities = SecurityCapabilities.fromCurrent()
	:Remove(Enum.SecurityCapability.CapabilityControl)
	:Remove(Enum.SecurityCapability.Unassigned)

It works but im not a fan of it since this requires me to know the capability of the script that the code is ran in and manually add or remove them