The way my system works is I made a table full of face ids, and then when the player joins I check for character added. When the character is added I randomize threw the table, and change the characters face id. Then I change the datastore value to the id picked, to save the face. But if the player had a face id already I just load the id in threw the value of the string.
Check bottom of script for issue
local faces = { 7074882, 33082306, 46997764, 34973033, 28009686, 48203113, 23931977, } local Players = game:GetService("Players") Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(char) local name = player.Name if player:WaitForChild("stats").face.Value == "nil" then local Chosen = faces[math.random(1, #faces)] print(Chosen) char.Head.face.Texture = "rbxassetid://"..Chosen player:WaitForChild("stats").face.Value = Chosen end end) end)
The system doesn't print anything for Chosen though it should, and the "rbxassetid://" changes but the id won't go into the texture. Why?
You are checking to see if the value of the face is "nil", which I assume you meant by nil. However, the default value for a StringValue is neither "nil" nor nil. It is simply "".
The way you could fix this is by doing this:
if player:WaitForChild("stats").face.Value == "" then