- What do you want to achieve?
I want to change the face texture of the player
- What is the issue?
When I change the Texture of the decal, the face becomes blank like in the image below
- What solutions have you tried so far?
I tried using print statements to debug the script and I also made sure that the decal ID changed.
Here is the WHOLE code
local removeHats = game.ReplicatedStorage:WaitForChild("RemoveHats")
local equipEvent = game.ReplicatedStorage:WaitForChild("EquipItem")
local IS = game:GetService("InsertService")
removeHats.OnServerEvent:Connect(function(plr)
local char = plr.Character or plr.CharacterAdded:Wait()
for i,v in pairs(char:GetChildren()) do
if v:IsA("Accessory") then
v:Destroy()
end
end
end)
equipEvent.OnServerEvent:Connect(function(plr,itemName,itemId,itemType)
local char = plr.Character or plr.CharacterAdded:Wait()
if itemType == "Hair" then
for i,v in pairs(char:GetChildren()) do
if v:IsA("Accessory") then
local ivVal = v:FindFirstChild("ItemType")
if ivVal then
if ivVal.Value == "Hair" then
v:Destroy()
end
end
end
end
local hair = IS:LoadAsset(itemId)
local hairA = hair:FindFirstChildOfClass("Accessory")
local iv = Instance.new("StringValue",hairA)
iv.Name = "ItemType"
iv.Value = itemType
hairA.Parent = char
hair:Destroy()
elseif itemType == "Hats" then
local hat = IS:LoadAsset(itemId)
local hatA = hat:FindFirstChildOfClass("Accessory")
local iv = Instance.new("StringValue",hatA)
iv.Name = "ItemType"
iv.Value = itemType
hatA.Parent = char
hat:Destroy()
elseif itemType == "Face" then
local face = char.Head:WaitForChild("face")
face.Texture = "http://www.roblox.com/asset/?id="..itemId
end
end)
This is where I change the Texture
elseif itemType == "Face" then
local face = char.Head:WaitForChild("face")
face.Texture = "http://www.roblox.com/asset/?id="..itemId
end
end)
Thanks in Advance.