Ok, so, I'm making a customize option for my game, and it includes a face changer GUI. I'm using a custom "StarterCharacter." On the dummy I put a custom face, and named it accordingly. I tested and found this script worked.
function onTouch(part)
local humanoid = part.Parent:FindFirstChild("Humanoid")
if (humanoid ~= nil) then -- if a humanoid exists, then
humanoid.Parent.Head.face.Texture = script.Parent.Decal.Texture
end
end
script.Parent.Touched:connect(onTouch)
script.Parent.Touched:connect(onTouch)
Instead of a part being touched though, its a GUI button that will be clicked to change the players face. This is one script I tried, but didn't work.
local humanoid = game.Player.LocalPlayer.Character script.Parent.MouseButton1Click:Connect(function() humainoid.Head.face:Destroy() humainoid.Head.face.Texture = "rbxassetid//10907551" end)
Any help why this isn't working? I'm new to Roblox Studio, so I'm still learning, bear in mind that when you see my bad scripting skills :P
Ok, so i think your issue is that you're setting humanoid's value to a character that doesn't yet exist (meaning your trying to get the character before it's even loaded in), a way to fix this would be to change the first line to:
local Humanoid = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
however, if you're looking to make the face show for everyone else in the server you'll have to know how to use RemoteEvents if you're making a single player game you can use the above method, if you're making a multiplayer game however, i'd reccomend learning Roblox Studio some more before attempting to unerstanding, if you don't wanna wait that long, you can always search the roblox API Reference for RemoteEvents an you'll get more info there.
Peace boi
from de FlabbyBoiii
I am seeing this, and i see it was posted 10 months ago but idc, you destroyed the face so there is no face to edit