GetAtributte is not a valid member of Player

Well, unfortunately when starting the game it does not detect the attributes and it gives me an error, and well I thought to add that if the player does not exist, wait a second and it did not work either

local Players = game:GetService("Players")

local player = Players.LocalPlayer or Players:GetPropertyChangedSignal("LocalPlayer"):wait(1)

local FPS = player:GetAttribute("FPS")

That just means that “FPS” isn’t a valid property of the player.

https://developer.roblox.com/en-us/api-reference/function/Workspace/GetRealPhysicsFPS

Use this function instead, in a local script.

1 Like

https://developer.roblox.com/en-us/api-reference/class/Player

You can see a list of valid properties of the player here.

1 Like

Well, the attributes (in this case it is FPS) he created them with a Server script when entering the game and it is to activate and deactivate the FPS counter (and then the data is saved with ProfileService)

It would be a child of the parent in that case, likely an IntValue or NumberValue instance, so instead use WaitForChild("") since it’s not an attribute, GetAttribute & SetAttribute are for getting the values and setting the values of attributes respectively.

1 Like

Do you understand how attributes work?

1 Like

well, I had it the way you said it, but I decided to load the data in the player itself, not in values ​​that are inside the player. This, since in a LocalScript it does not let you access the ProfileService, I decided that when the player entered, the attributes with the data would be put

“FPS” is not a property of the Player instance.

1 Like

What’s the script which is storing FPS?

1 Like

What are you talking about, I never said it was?

1 Like

You never said anything? We’re typing.

1 Like

Provide the script which is storing FPS information about each player, thanks.

1 Like

A server script collects the data from a ModuleScript (ProfileService).

You replied to me saying “FPS” Is not a valid property

1 Like
Players.PlayerAdded:Connect(function(player)
	local Profile = DataManager:Get(player, true)
	if not Profile then
		repeat task.wait(0.1)
			Profile = DataManager:Get(player, true)
		until Profile or (not player.Parent)
	end
	if Profile then
		--Obtener las herramientas
		for _, ToolsWithStacks in pairs(Profile.Data.Tools.ToolsWithStacks) do
			if not toolsFolder:FindFirstChild(ToolsWithStacks[1].ToolName) then continue end
			for i = 1, #ToolsWithStacks do
				local Tool = toolsFolder[ToolsWithStacks[1].ToolName]:Clone()
				Tool:WaitForChild("Stack").Value = ToolsWithStacks[i].Stacks
				Tool.Parent = player:WaitForChild("Backpack")
				local ToolGear = toolsFolder[ToolsWithStacks[1].ToolName]:Clone()
				ToolGear:WaitForChild("Stack").Value = ToolsWithStacks[i].Stacks
				ToolGear.Parent = player:WaitForChild("StarterGear")			
			end
		end
		for _, ToolsWithoutStacks in pairs(Profile.Data.Tools.ToolsWithoutStacks) do
			if not toolsFolder:FindFirstChild(ToolsWithoutStacks.ToolName) then continue end
			for i = 1, ToolsWithoutStacks.Amount do
				local Tool = toolsFolder[ToolsWithoutStacks.ToolName]:Clone()
				Tool.Parent = player:WaitForChild("Backpack")
				local ToolGear = toolsFolder[ToolsWithoutStacks.ToolName]:Clone()
				ToolGear.Parent = player:WaitForChild("StarterGear")
			end
		end
		task.wait(0.1)
		--Configuraciones
	--Apartado de gráficos
		shadowSettings[Profile.Data.Game_Configurations.Graphics.Shadows](player, Profile)
		waterSettings[Profile.Data.Game_Configurations.Graphics.Water](player, Profile)
		treeSettings[Profile.Data.Game_Configurations.Graphics.Tree](player, Profile)
	--Apartado de configuraciones del juego
		ViewFPS[Profile.Data.Game_Configurations.General.FPS](player, Profile)
		ViewPing[Profile.Data.Game_Configurations.General.Ping](player, Profile)
		VolumenDeBrillo["Gamma"](player, Profile.Data.Game_Configurations.General.BrilloVol)
		MyThingsWith[Profile.Data.Game_Configurations.General.PlayerChose](player, Profile)
		SlotsInventory["SlotsSize"](player, Profile.Data.Game_Configurations.General.SlotsInventory)
	--Apartado de configuraciones controles
		SettingCrouch[Profile.Data.Game_Configurations.Controls.Crouch](player, Profile)
		SettingSprint[Profile.Data.Game_Configurations.Controls.Sprint](player, Profile)
		
		LanguageConfg[Profile.Data.Game_Configurations.General.Language](player, "PlayerAdded", Profile)
		
		--Atributos del jugador
		player:SetAttribute("Shadow", Profile.Data.Game_Configurations.Graphics.Shadows)
		player:SetAttribute("Water", Profile.Data.Game_Configurations.Graphics.Water)
		player:SetAttribute("Tree", Profile.Data.Game_Configurations.Graphics.Tree)
		
		player:SetAttribute("FPS", Profile.Data.Game_Configurations.General.FPS)
		player:SetAttribute("Ping", Profile.Data.Game_Configurations.General.Ping)
		player:SetAttribute("BrilloVol", Profile.Data.Game_Configurations.General.BrilloVol)
		player:SetAttribute("PlayerChose", Profile.Data.Game_Configurations.General.PlayerChose)
		player:SetAttribute("SlotsInventory", Profile.Data.Game_Configurations.General.SlotsInventory)
		player:SetAttribute("Lenguage", Profile.Data.Game_Configurations.General.Language)
		
		player:SetAttribute("Crouch", Profile.Data.Game_Configurations.Controls.Crouch)
		player:SetAttribute("Sprint", Profile.Data.Game_Configurations.Controls.Sprint)
		--Añadir nuevamente los datos despues de morir
		player.CharacterAdded:Connect(function(char)
			wait(0.3)
			--Apartado de gráficos
			shadowSettings[Profile.Data.Game_Configurations.Graphics.Shadows](player, Profile)
			waterSettings[Profile.Data.Game_Configurations.Graphics.Water](player, Profile)
			treeSettings[Profile.Data.Game_Configurations.Graphics.Tree](player, Profile)
			--Apartado de configuraciones del juego
			ViewFPS[Profile.Data.Game_Configurations.General.FPS](player, Profile)
			ViewPing[Profile.Data.Game_Configurations.General.Ping](player, Profile)
			VolumenDeBrillo["Gamma"](player, Profile.Data.Game_Configurations.General.BrilloVol)
			MyThingsWith[Profile.Data.Game_Configurations.General.PlayerChose](player, Profile)
			SlotsInventory["SlotsSize"](player, Profile.Data.Game_Configurations.General.SlotsInventory)
			--Apartado de configuraciones controles
			SettingCrouch[Profile.Data.Game_Configurations.Controls.Crouch](player, Profile)
			SettingSprint[Profile.Data.Game_Configurations.Controls.Sprint](player, Profile)
			wait(0.2)
			LanguageConfg[Profile.Data.Game_Configurations.General.Language](player, "FireToLoadNow", Profile)
		end)
	end
end)

sorry, spanish is my native language

That’s not how attributes work. They don’t work similarly indexing a property. They are read and written by invoking methods. If FPS is not an existing attribute of player, it’ll simply return nil.

Please read my statement above. The error that the OP is receiving is not related to it being set or not.


To answer the OP, your issue may be that you’re misspelling the method. And as a side note, the or :GetPropertyChangedSignal() is unnecessary.

2 Likes

Are you sure the FPS attribute is getting set?

1 Like

yes, Profile Service is safe so no data is lost, therefore if you load everything

I mean, attributes are set when player enters

I see in your title that you say “GetAtributte” when it should be “GetAttribute”. Are you sure you spelled it correctly in your code?

Also on a side note, if players.LocalPlayer was ever nil for whatever reason, doing :GetAttributeChangedSignal(‘LocalPlayer’):Wait() would return nil, so you’d have to do something like

local player = Players.LocalPlayer or Players:GetPropertyChangedSignal("LocalPlayer"):Wait() or players.LocalPlayer
2 Likes