I am trying to make a NPC face texture change if you touch a certain part (with the same parents). Here is a exemple of a script i tried to execute (under many angles):
debounce = false script.Parent.Touched:connect(function(hit) if not debounce then debounce = true if(hit.Parent:FindFirstChild("Humanoid")~=nil)then local player = game.Players:GetPlayerFromCharacter(hit.Parent) script.Parent.CanTouch = false script.Parent.face.Texture = "rbxassetid://x" wait(1.5) end debounce = false end end)
This above script has as parent the Head of the dummy. Now, here's the script I put in a "TriggerPart" in the dummy.
debounce = false script.Parent.Touched:connect(function(hit) if not debounce then debounce = true if(hit.Parent:FindFirstChild("Humanoid")~=nil)then local player = game.Players:GetPlayerFromCharacter(hit.Parent) script.Parent.CanTouch = false script.Parent.Dummy.Head.face.Texture = "rbxassetid://x" wait(1.5) script.Parent.Dummy.Head.face.Texture = "rbxassetid://x" wait(10) end debounce = false end end)
Yet, the script above don't have a single effect on the face of the dummy, if someone could help me, i'd really apreciate it! (btw i'm a begginer and really bad scripter, and the "x" remplace the texture Id in-game.)
Thanks!
script.Parent.Touched:Connect(function(TPart) local Human = TPart.Parent:FindFirstChildWhichIsA("Humanoid") if Human then TPart.Parent.Head.face.Texture = "rbxassetid://6399193086" -- Replace this number with id of the image you would like to use. end end)
replace the 6399193086 with the image id you would like to use.