How do I make when a player touches a button it changes their character face
2 Likes
Pretty easy, just do this:
local ID = --your ID of the decal/face
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local head = hit.Parent.Head
head.face.Texture = ID
end
end)
sorry for being late!
If this button was a click detector, you can have a script inside of the parent of the clickdetector. Not sure if this will work as I have never worked with decals in scripts.
local faceId = 0 -- for this, you might want to make an image of the face then copy it's id and replace the 0 with it
script.Parent.ClickDetector.MouseClick:Connect(function(plr)
local char = plr.Character
repeat wait() until char.Head
if char.Head:FindFirstChild("Face") or char.Head:FindFirstChild("face") then
for i, v in pairs(char.Head:GetChildren()) do
if v:IsA("Decal") then
if v.Name == string.lower("face") then
v.Texture = "rbxassetid://" .. faceId
end
end
end
end)
place a part in workspace. That part will be your button. Under that part place a script. put this in the script:
local Face = game.ReplicatedStorage.NewFace
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“Humanoid”) then
hit.Parent.Head.face:Destroy()
local newface = Face:Clone()
newface.Parent = hit.Parent.Head
end
end)
Then put your face in replicated storage and call it NewFace. The face must be a decal with your image in the texture property.
Ok thank you I will try it
1 Like