I was trying to make a TextLabel that if a player is added into the game, then the text of label will change to the attribute value of the player. I tried to make but it didn't work.
game.Players.PlayerAdded:Connect(function(Player)
local ItemToSell = Player:GetAttribute("ItemToSell")
local Money = Player:GetAttribute("Money")
script.Parent.ItemToSell.Text = ItemToSell
script.Parent.Money.Text = Money
end)
This will not work because your code is being run right after a player joins, this means any attributes that are being set will not exist when your code is called.
This may be a good read for you: https://developer.roblox.com/en-us/articles/Data-store