I used ctrl + f and wasn’t able to find any :GetAttribute.
Well, I am confused. You mean the one who puts the attributes or the one who gets the attributes?
The one that puts the attributes.
Ah no, the script that puts them, does not get them after putting it, it only puts them
I’m a little confused, can you show the script that is causing the error?
It is not complete, but it gives me the error in obtaining the attribute, I mean, I realized that since the script that puts the attributes is very extensive, it took time to put the attributes, therefore, it gives an error, there are no until later in a few seconds
local Heartbeat = game:GetService("RunService").Heartbeat
local Players = game:GetService("Players")
local FpsLabel = script.Parent
local player = Players.LocalPlayer or Players:GetPropertyChangedSignal("LocalPlayer"):Wait() or Players.LocalPlayer
local FPS = player:GetAttribute("FPS")
Wait, is this a server script? Since you didn’t specify it.
Hmm, I’m actually kinda confused, not sure why it’s causing the error. Which line is causing the error?
at least this part is server script
In this part specifically, from what i mentioned earlier that it doesn’t load the data on time
I mean the very first code you showed in your original post, is that from a local script or server script?
ah, is a LocalScript, it does not work for me if the script is server
Yeah. The error looks like a spelling mistake. Can you send me a screenshot of your current code? Or just copy paste it without editing it.
If they don’t load on time, or sometimes they load on time, you can use GetAttributeChangedSignal
to update the variable, also inside you can put what should happen when you get the variable.
local FpsLabel = script.Parent
local player = game:GetService("Players").LocalPlayer
local FPS = player:GetAttribute("FPS") or ""
player:GetAttributeChangedSignal("FPS"):Connect(function()
FPS = player:GetAttribute("FPS") or ""
end)
Sorry for the delay, my computer is giving no more time to break down
Wait, I’m doing a lot of things and I can’t focus on one. in a while I’ll put it to the test
I actually am not sure at all. Everything looks fine here. Even if the attribute would be nil when trying to retrieve it, it wouldn’t throw an error, it would just set the variable “FPS” to nil.
I thought they were conflating attributes w/ properties, and typically player stats so to say are stored as some value type instance inside the player instance itself.
This is an issue with accessing the GetAttribute member in Player, not that FPS isn’t a member of player.
Attributes return nothing if the attribute is undefined.
To the OP:
That code should work. LocalPlayer will always have a value in a LocalScript and the or Players:GetPropertyChangedSignal("LocalPlayer"):Wait()
would never be reached.
It might be worth investigating to see if it’s this line, and not another line with the same call
From what I have seen, I was right, it takes too long to put the attributes since the script exceeds 800 lines, that and that the script had to load all the data