I wanted to make this customization thing for my game. But for some reason I am having trouble on changes the eyes
When pressing the arrows to switch the eyes, it does not change the eyes. ( I didn’t add the whole script onto the forum)
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local module = {}
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local characterClothing = character:WaitForChild("Clothing")
local characterHead = character:WaitForChild("Head")
local bodyParts = {
Head = character:WaitForChild("Head"),
Torso = character:WaitForChild("Torso"),
["Left Leg"] = character:WaitForChild("Left Leg"),
["Right Leg"] = character:WaitForChild("Right Leg"),
["Left Arm"] = character:WaitForChild("Left Arm"),
["Right Arm"] = character:WaitForChild("Right Arm")
}
local appearanceItemColors = {}
local clothing = ReplicatedStorage.Assets.Clothing
local module = {
--Hair
Hair = function(currentNumber)
local hair = clothing.Hair:FindFirstChild(currentNumber)
if not hair then
return
end
for _, lastHair in ipairs(characterClothing.Hair:GetChildren()) do
lastHair:Destroy()
end
local hairClone = hair:Clone()
hairClone.Color = appearanceItemColors.Hair or Color3.fromRGB(255, 255, 255)
hairClone.CFrame = bodyParts.Head.HairAttachment.WorldCFrame * CFrame.new(hairClone:GetAttribute("Position") or workspace.br8.Value)
hairClone.Parent = characterClothing.Hair
local weldConstraint = Instance.new("WeldConstraint")
weldConstraint.Part0 = hairClone
weldConstraint.Part1 = bodyParts.Head
weldConstraint.Parent = hairClone
end,
--Eyes
Eyes = function(currentNumber)
local eye = clothing.Eyes:FindFirstChild(currentNumber)
if not eye then
return
end
for _, lastEye in ipairs(characterHead["1"]:GetChildren()) do
lastEye:Destroy()
end
local eyeClone = eye:Clone()
eyeClone = bodyParts.Head
eyeClone = characterHead
end,
--Shoes
Shoes = function(currentNumber)
local shoe = clothing.Shoes:FindFirstChild(currentNumber)
for _, lastShoe in ipairs(characterClothing.Shoes:GetChildren()) do
lastShoe:Destroy()
end
for _, leg in ipairs({"Right", "Left"}) do
local legPart = bodyParts[leg .. " Leg"]
local shoeClone
if shoe and shoe:IsA("MeshPart") then
shoeClone = shoe:Clone()
elseif shoe and shoe:IsA("Model") then
shoeClone = shoe:FindFirstChild(leg):Clone()
end
shoeClone.Color = appearanceItemColors.Shoes or Color3.fromRGB(255, 255, 255)
shoeClone.CFrame = legPart:FindFirstChild(leg .. "FootAttachment").WorldCFrame * CFrame.new(0, 0.1, -0.05)
shoeClone.Parent = characterClothing.Shoes
local weldConstraint = Instance.new("WeldConstraint")
weldConstraint.Part0 = shoeClone
weldConstraint.Part1 = legPart
weldConstraint.Parent = shoeClone
end
end,
--Shirt
Shirt = function(currentNumber)
local shirt = clothing.Shirt:FindFirstChild(currentNumber)
if shirt and shirt:IsA("MeshPart") then
for _, lastPart in ipairs(characterClothing.Shirt:GetChildren()) do
lastPart:Destroy()
end
local shirtClone = shirt:Clone()
shirtClone.Color = appearanceItemColors.Shirt or Color3.fromRGB(255, 255, 255)
shirtClone.CFrame = bodyParts.Torso.CFrame * CFrame.new(shirtClone:GetAttribute("Position") or Vector3.new())
shirtClone.Parent = characterClothing.Shirt
local weldConstraint = Instance.new("WeldConstraint")
weldConstraint.Part0 = shirtClone
weldConstraint.Part1 = bodyParts.Torso
weldConstraint.Parent = shirtClone
elseif shirt and shirt:IsA("Model") then
characterClothing.Shirt:Destroy()
local shirtClone = shirt:Clone()
shirtClone.Name = "Shirt"
for _, part in ipairs(shirtClone:GetChildren()) do
part.Color = appearanceItemColors.Shirt or Color3.fromRGB(255, 255, 255)
part.CFrame = bodyParts[part.Name].CFrame * CFrame.new(part:GetAttribute("Position") or Vector3.new())
local weldConstraint = Instance.new("WeldConstraint")
weldConstraint.Part0 = part
weldConstraint.Part1 = bodyParts[part.Name]
weldConstraint.Parent = part
end
shirtClone.Parent = characterClothing
end
end,
--Pants
Pants = function(currentNumber)
local pants = clothing.Pants:FindFirstChild(currentNumber)
if pants and pants:IsA("Model") then
characterClothing.Pants:Destroy()
local pantsClone = pants:Clone()
pantsClone.Name = "Pants"
for _, part in ipairs(pantsClone:GetChildren()) do
part.Color = appearanceItemColors.Pants or Color3.fromRGB(255, 255, 255)
part.CFrame = bodyParts[part.Name].CFrame * CFrame.new(part:GetAttribute("Position") or Vector3.new())
local weldConstraint = Instance.new("WeldConstraint")
weldConstraint.Part0 = part
weldConstraint.Part1 = bodyParts[part.Name]
weldConstraint.Parent = part
end
pantsClone.Parent = characterClothing
end
end,