You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I am trying to create a script inside of part that when a player touches it, they receive a random face. -
What is the issue? Include screenshots / videos if possible!
When the player touches the part, the face decal successfully changes, but it turns the face blank instead of displaying the new decal. Interestingly, the Texture turns to only the number, without “rbxassetid://”. When I tried adding the “rbxassetid://” through Explorer when playtesting, it had no effect. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
This DevForum post had the identical problem, but it did not solve my problem. It’s also worth noting that this script throws no error messages.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
This is my full script, please don’t mind if it is messy, I’m not a very good programmer and this is kind of an amalgamation of different scripts.
FaceId = {141728790, 255827175, 277950647, 398675764, 268603331, 209994929, 173789324, 21311601}
--Variables
local head = script.Parent
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if h ~= nil then
if part.Parent:findFirstChild("Head"):findFirstChild("face").Texture == nil then return end
if part.Parent:findFirstChild("Head"):findFirstChild("face").Texture ~= nil then
local var = FaceId[math.random(1,8)]
wait(.1)
part.Parent:findFirstChild("Head"):findFirstChild("face").Texture = ("rbxassetid://" .. var)
wait(.1)
part.Parent:findFirstChild("Head"):findFirstChild("face").Texture = var
end
end
end
script.Parent.Touched:connect(onTouched)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.