Just theoretically, say I have a game in which every part that is spawned; (which will be on a while wait() do) loop, and those parts are to go down, and then first get an attribute of the name will be “Not an Apple” , true. Afterwards, the part will then get it’s attribute changed to “Apple”, true
Is that going to cause lag? Will it cause lag spikes? I haven’t really got any idea whether or not it will or won’t.
No. In fact, they are technically faster than using Value objects (e.g. StringValue) at a CPU performance level. At a network level (replicating the changes from the server to the client), it is just a small piece of data. You won’t notice it at all.
Think about it this way: Every network update, the game is updating tons of moving parts from characters and having to interpolate them to make everything appear very smooth. That’s a lot of data moving in and out constantly! By simply changing an attribute from true to false, that’s just a small drop in the bucket.
That all being said, I would not set the attribute every frame if possible. Just set it when it actually needs to change.
Perhaps, but that won’t replicate to the client. If the goal is to communicate changes across all clients that are linked to specific instances, attributes are a safe solution
Other advantages of using Attributes is there’s no property naming collisions (ever create a StringValue named “Name”"?) and they error out if they don’t exist. For example if part.StringValue will error if StringValue is not present on the part, but if part:GetAttribute("StringValue") will not error.