How to check permission level on instance

I want to check if the instance permission level is below 5, for example:

if instance:GetPermissionLevel() <= 4 then

end

or

if instance.permissionlevel <= 4 then

end

So you probably get a point, so how I would be able to check if I can access certain instance?

Since I am trying to avoid getting the errors such as those:

image

What is this for? Instances don’t have permission levels. You can use the function printidentity() to get the permission level of the thread.

I am making antivirus plugin, which scans everything, but I want to avoid getting errors, so I want to double check if I can access the instance.

Plugins have a very high permission level, they can access things like coregui, so I don’t think this should be an issue? And btw what is the point? It is very easy to check for viruses/backdoors, there are tons of tutorials and posts on it

My point that I am developing my own antivirus, I have right to anyways, can you give an example on how to use printidentity()?

Just call it and in the output you will see “The current identity is X”

printidentity()

That is it.

1 Like

So there is no way to check if I have access to certain instance or service?

As I said plugins have access to a lot of things, so if they’re able to insert into locked stuff then you can look for locked stuff too.

Yeah but I am running to problem where I am getting lack of permission on level 5, but i have 4, so I just wanted to know how I would able to check if I can access it, without getting errors and stopping the script. I am thinking of using pcall()

Yeah, use pcall() to avoid the error being thrown; there’s not any way to check a Service’s permission level as far as I know.

2 Likes

I wish there was .RobloxLocked or a .permissionlevel thing, which would allow us as developers easily check if we have access to it, instead of creating blacklist to prevent accessing those.

1 Like

You can always make a #platform-feedback:studio-features post to request it.

1 Like