So basically I'm making a face changer UI, And the code linked worked fine. Until I tried to show my friend it in a game, Which then, he didn't see my changed face. So I thought the script being a local script was the problem, So i made it a regular script and now i get this
Players.andypop12345.PlayerGui.FaceChangeUi.FaceChange.AngrySadE.ImageButton.Script:5: attempt to index nil with 'Name'
Here's the script I attempted to use
local player = game.Players.LocalPlayer local face = "http://www.roblox.com/asset/?id=5965483051" script.Parent.MouseButton1Down:Connect(function() game.Workspace[player.Name].Chest.FaceHere.Face.Texture = face end)
Line 5 is the line that's giving the error And feel free to just give me the code if you want, but that's lazy me talking, I want to learn how to script better and stuff so try just point out why its not working instead of just giving me the solution.
I think what is happening is that the script is looking for the face when it has not loaded, Roblox avatar parts do not load instantly, they load when they decide to
local player = game.Players.LocalPlayer local face = "http://www.roblox.com/asset/?id=5965483051" script.Parent.MouseButton1Down:Connect(function() local facepart = game.Workspace:WaitForChild(player.Name):WaitForChild("Chest"):WaitForChild("Face") facepart.AssetId = face end)
hope this helped! if not please let me know