You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I would like to be able to access to the values of the attributes.
What is the issue? Include screenshots / videos if possible!
The following script is a simple script, not module, not local.
It returns the right variable format, but what’s in the value isn’t right.
local Folder = game.Workspace.Date.Giocatori:FindFirstChild("=" ..player.Name)
local Nome = Folder:GetAttribute("Nome") --string, can't find value
local Color = Folder:GetAttribute("Colore") --Color3, can't find value
local Intro = Folder:GetAttribute("Intro") --bool, can't find value
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
tried searching around, sadly found nothing
@mniao
The attributes value is getting changed in a module script.
The code where I cange the value is the following:
local ChangeNameColor = {}
function ChangeNameColor.ChangeName(player, name)
local Tag = game.Workspace.Date.Giocatori:FindFirstChild("=" .. player.Name)
Tag:SetAttribute("Nome",name)
end
function ChangeNameColor.ChangeColor(player, Color)
local Tag = game.Workspace.Date.Giocatori:FindFirstChild("=" .. player.Name)
Tag:SetAttribute("Colore",Color)
end
return ChangeNameColor
The script which i’m asking help with is a script where i save the Attributes, but the script is having problems getting the Attributes values.
You should do a print like this to check if it’s actually running the code and setting it to the value that it’s supposed to be
local Tag = game.Workspace.Date.Giocatori:FindFirstChild("=" .. player.Name)
Tag:SetAttribute("Nome",name)
print(Tag, name, player) --Does this print? is it printing the correct values if it is printing?
Alright, then maybe it’s not getting the correct instance somehow?
local Folder = game.Workspace.Date.Giocatori:FindFirstChild("=" ..player.Name)
print(Folder:GetFullName()) --is it the correct instance?
local Nome = Folder:GetAttribute("Nome") --string, can't find value
local Color = Folder:GetAttribute("Colore") --Color3, can't find value
local Intro = Folder:GetAttribute("Intro") --bool, can't find value
Also i’m sorry but i don’t understand exactly what you mean by this
I made a test script using your code and it seems to work, here’s the code i used.
local players = game:GetService("Players")
local ChangeNameColor = {}
function ChangeNameColor.ChangeName(player, name)
local Tag = game.Workspace.Date.Giocatori:FindFirstChild("=" .. player.Name)
Tag:SetAttribute("Nome",name)
end
function ChangeNameColor.ChangeColor(player, Color)
local Tag = game.Workspace.Date.Giocatori:FindFirstChild("=" .. player.Name)
Tag:SetAttribute("Colore",Color)
end
players.PlayerAdded:Connect(function(player)
local testFolder = Instance.new("Folder")
testFolder.Name = "="..player.Name
testFolder.Parent = workspace.Date.Giocatori
task.wait(10)
ChangeNameColor.ChangeColor(player, Color3.new(1, 0, 0))
ChangeNameColor.ChangeName(player, "name wow")
task.wait(10)
local Folder = game.Workspace.Date.Giocatori:FindFirstChild("=" ..player.Name)
local Color = Folder:GetAttribute("Colore")
local Nome = Folder:GetAttribute("Nome")
print(Color) --prints correct value
print(Nome) --also prints correct value
end)
Are you sure you’re not setting the attributes on a client script?
Bingo, you are basically setting the attributes on a localscript as when you require() it’s basically running the module code on that script, please set the attributes on the server instead.