Unable to retrieve attributes from LocalScript

Hi all, so I’ve run into a bit of an awkward point in development rn. The gist of it is this:
I have a ServerScript that sets an attribute to itself to securely transmit certain pieces of information without having to mess about with events or values or any of that. In theory, this should work fine.
However, the problem I have is this. I’m trying to get the value of the attribute from said item within a LocalScript via

[Path-to-item]:GetAttribute("Attribute")

However, when doing this, even doing infinite “repeat x until y” and “while not x” statements, waiting on the Attribute to be non-nil, it would never actually become non-nil, and would instead just endlessly loop the statements until I exit the Studio instance.
Would be nice to know how GetAttribute plays with a LocalScript, attempting to find a value set by the Server. For further reference, both the LocalScript and the item with the attribute (a ServerScript) are within the same tool.

1 Like

Attribute replication should work just fine similarly to the value bases. You certainly explained well and know the concept, so the problem might be hiding in specific code. Would you please send us relevant code?

Was just about to send the code when I realised a problem with it. I’m using modulescripts and metatables to convert a folder of values for a specific tool into a referenceable dictionary, in the format of:

Config = {
    ["Model"] = (Root of the tool)
    ["Config"] = {
        ["Damage"] = ...
        ["Firerate"] = ...
        ["ReloadTime"] = ...
        etc etc
    }
}

So in the main code where I reference the config for the tools themselves, instead of referencing
Config["Config"]["Firerate"]
I was doing
Config["Firerate"]
Appreciate the time you took for being willing to read through my code, but I’ve remedied the situation now, obviously got tunnel vision when working with Attributes lol.

1 Like

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