yeah I'm back, but this script will only cause 1 accessory to change the colors and I dont know how to change it, can someone help me?
Debounce = true
TweenService = game:GetService("TweenService")
info = TweenInfo.new(0.1,Enum.EasingStyle.Linear)
goal = {}
goal.Color = Color3.fromRGB(159, 243, 233)
function onTouch(part)
local humanoid = part.Parent:FindFirstChild("Humanoid")
if Debounce then
if (humanoid ~= nil) then
if humanoid.Parent.Infected.Value == false then
humanoid.Parent.Infected.Value = true
humanoid.Parent.HumanoidRootPart.Anchored = true
local anim = humanoid:LoadAnimation(script.Parent.Animation)
anim:Play()
Debounce = false
wait(0.5)
for _, child in ipairs(humanoid.Parent:GetChildren()) do
if child.ClassName == "Accessory" then
if child.Handle:FindFirstChild("Mesh") then
child.Handle.Mesh.TextureId = ""
end
if child.Handle:FindFirstChild("SpecialMesh") then
child.Handle.SpecialMesh.TextureId = ""
end
--problem is here
for i,child in pairs(child:GetChildren()) do
hattween = TweenService:Create(child.Parent.Handle,info,goal)
end
end
end
local tween = TweenService:Create(humanoid.Parent.Torso,info,goal)
local tween2 = TweenService:Create(humanoid.Parent["Left Arm"],info,goal)
local tween3 = TweenService:Create(humanoid.Parent["Right Arm"],info,goal)
local tween4 = TweenService:Create(humanoid.Parent["Left Leg"],info,goal)
local tween5 = TweenService:Create(humanoid.Parent["Right Leg"],info,goal)
local tween6 = TweenService:Create(humanoid.Parent.Head,info,goal)
tween:Play()
tween2:Play()
tween3:Play()
tween4:Play()
tween5:Play()
tween6:Play()
hattween:Play()
wait(0.45)
Debounce = true
humanoid.Parent.HumanoidRootPart.Anchored = false
end
end
end
end
script.Parent.Touched:connect(onTouch)
