Lacking permission, need help

Suit.Parent.SurfaceAppearance.ColorMap = ("rbxassetid://"..GetRandomColor())

I have this line of code, and i thought it whould work just fine, when i just got this while testing it:

The current identity (2) cannot ColorMap (lacking permission 1)

Just for context the GetRandomColor function works as i planned, its just a function that returns a number from a dictionary

function GetRandomColor()
  local tamanho = Length(Colors)
  local numb = math.random(1,tamanho)
  local i = 1
  for name, id in pairs(Colors) do
    if i == numb then
        return id
    i = i + 1

And the context in general is that i want to change the ColorMap in a Texture inside an accessory, if anybody can help me on this…

Also sorry if my english is bad, its not my first language

1 Like

You can’t change surface appearance properties via a script. The only alternative is to parent them to the object and remove them.

In your case, I would make all the surface appearances and then pick a random one out of the table, then clone and parent it to the object while removing the old one.