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")
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.
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
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)
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.
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