Change players face script wont work!

This local script under a part named “ChangeFacePart” wont work here it is can someone tell me the issue? there seems to be no errors logged in the output

-- Change the player's face when touching the part

local part = script.Parent

part.Touched:Connect(function(hit)
    local character = hit.Parent
    local humanoid = character:FindFirstChild("Humanoid")
    local face = character:FindFirstChild("Head"):FindFirstChild("face")

    if humanoid and face then
        script.Parent.face.Texture = "rbxassetid://398852783"
    end
end)

why wont it work?
the script is a local script that is under a part
1 Like

Make it a server script, if it’s parented to the part it won’t run as a LocalScript, also, it has an error, in line 8, to fix it, make the following changes:

-- Change the player's face when touching the part

local part = script.Parent

part.Touched:Connect(function(hit)
	local character = hit.Parent
	local humanoid = character:FindFirstChild("Humanoid")

    if not humanoid then
        return
    end

	local face = character:FindFirstChild("Head"):FindFirstChild("face")

	if face then
		face.Texture = "rbxassetid://398852783"
	end
end)
1 Like

should i change it to a script and put it in server script service?

i tried it in a normal script in server script service and got this error

Touched is not a valid member of ServerScriptService "ServerScriptService"

i fixed it i did ur instructions wrong thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.