There’s an error at line 53 that says “Attempted to index number with clone” But I dont understand what the problem is. It’s supposed to pick clothing items from different folders that are there.
local default_death_sounds = {"rbxassetid://146594640", "rbxassetid://146594648", "rbxassetid://146457047"}
local body_part_names = {"Head", "LeftArm", "LeftLeg", "RightArm", "RightLeg", "Torso"}
local hairs = script.Folder['Hairs']:GetChildren()
local faces = script.Folder['Faces']:GetChildren()
local shirts = script.Folder['Shirts']:GetChildren()
local pants = script.Folder['Pants']:GetChildren()
local hair = math.random(1, #hairs)
local facelol = math.random(1, #faces)
local shirt = math.random(1, #shirts)
local pant = math.random(1, #pants)
--functions-----
local TypeList = { --All available effect types for this kill effect
NoDeletion = function(model, common_functions, cleanup_time, ppos)
common_functions.DefaultDamageReceiverHandle(model, cleanup_time, ppos)
end,
Damaged = function(model, common_functions, cleanup_time, ppos)
end,
Character = function(model, hum, common_functions, cleanup_time, ppos) --Run the full effect on a character
common_functions.PlaySoundInPart(model:FindFirstChild("Torso"), default_death_sounds)
common_functions.RemoveClothing(model)
common_functions.RemoveHats(model)
local b_col = model:FindFirstChild("Body Colors")
if b_col ~= nil then
for _, nm in pairs(body_part_names) do
b_col[nm .. "Color"] = BrickColor.new("Pastel brown")
end
end
pant:Clone()
shirt:Clone()
hair:Clone()
hair.Name = "Hair"
pant.Name = "Pants"
shirt.Name = "Shirt"
hair.Parent = model
shirt.Parent = model
pant.Parent = model
local head = model:FindFirstChild("Head")
if head ~= nil then
local face = head:FindFirstChild("face")
if face ~= nil then
face.Texture = facelol
end
end
local physService = game:GetService("PhysicsService")
for i,v in ipairs(model:GetChildren()) do
if v:IsA("BasePart") then
physService:SetPartCollisionGroup(v, "ragdolls")
end
end
return common_functions.DefaultRagdollHandle(model, hum, cleanup_time, ppos) --has to return object for death cam to attach to
end,
Universal = function(model, common_functions, cleanup_time, ppos) --Run the effect on a non-character model with full permissions for altering
common_functions.DefaultDamageReceiverHandle(model, cleanup_time, ppos)
end,
}
return TypeList
local hairs = {}
local faces = {}
local shirts = {}
local pants = {}
for i, v in pairs(script.Folder['Hairs']) do
hairs[i] = v
end
for i, v in pairs(script.Folder['Faces']) do
faces[i] = v
end
for i, v in pairs(script.Folder['Shirts']) do
shirts[i] = v
end
for i, v in pairs(script.Folder['Pants']) do
pants[i] = v
end
local hair = pants[math.random(1, #hairs)]
local facelol = faces[math.random(1, #faces)]
local shirt = shirts[math.random(1, #shirts)]
local pant = pants[math.random(1, #pants)]
That wouldn’t really change anything as if it’s a table it just copies it.
(Also I guess it’s likely an Instance so it would error as pairs in Luau only works for tables)