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:
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
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?
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.