Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Face decal copy block script not functioning?

Asked by 5 years ago
Edited 5 years ago

I have a script that when you touch a block named something, it puts the decal of the touched block on your face of the player.

The script goes in the serverscriptstorage but doesn't seem to work.

I got help the other day on getting where I am now and I appreciate those efforts, but if anyone could help getting this script operational that would be great!

Any feedback is great and thank you in advance!

Maybe I should switch the order of the functions?

01function getDecal()
02local decals = game.Workspace:GetDescendants()
03 
04for i,v in pairs (decals) do
05if v:IsA("Decal") then -- check if the descendant is a decal
06    if v.Parent.Name == "FaceChanger" then -- the decal's parent's name
07        v.Touched:Connect(function(hit)
08            -- clones the texture to the hit.Parent's face, make sure to check if their humanoid is present first
09        end)
10    end
11end
12end
13end
14 
15function onTouch(hit)
View all 27 lines...
0
Update: switching order did not resolve issue 2sail2you 4 — 5y

1 answer

Log in to vote
0
Answered by
JPT79 92
5 years ago

Delete the head's current decal, then clone the new one and parent it to the head instead Something like this

1if face.Texture ~= getDecal().Texture then
2    face:Destroy()
3    local clone = getDecal():Clone()
4    clone.Parent = head
5    clone.Name = "face"
6end

I'm no scripting expert myself, but I assume this should work

Ad

Answer this question