Property OnlyRead Checker

Hello Roblox Dev Community,

Info

Code
type or paste code here

Achieve
So what i want to achieve is that he checks if the property can be written on and is NOT OnlyRead, but it just doesn’t works and keep sending this print:
image

I hope everyone has an good day!
:waffle: :wave:

There really isn’t a way to check if a property is read only, you can wrap your function into a pcall so if it errors then you will know that the property can’t be modified.

local success = pcall(function()
    -- set property here
end)

if not success then
    -- property value can't be changed
end
1 Like
local function isReadOnly(instance, property)
    return not (pcall(function()
        instance[property] = instance[property] -- errors if readonly, or nonexistant
    end))
end
print(isReadOnly(workspace, "Name")) --> false?
print(isReadOnly(workspace, "ClassName")) --> true?
3 Likes

Thank you very much, i forgot to put the solution thing on @TNQR_iKingNinja, also thanks to @blueberry for creating the full function. I would have putten both as Solution, but that isn’t possible. So i setted it as the first one. I also just found out the code didn’t load in my post weirdly enough.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.