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
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)