You say that this is a touched event, but I don’t see touched anywhere. Is this inside of a touched script? If so, on line 3 you set Character to script.Parent instead of setting Character to the parent of what hit the script’s parent.
Example:
script.Parent.Touched:Connect(funtion(hit)
local Character = hit.Parent
end)
Edit: One thing about your table: you checking if theres a key in your table called “Right Arm”. There are only keys in a table if the table is a dictionary. Either convert you table into a dictionary or use table.find()
Example:
script.Parent.Touched:Connect(funtion(hit)
local Character = hit.Parent
for i,v in pairs(Character:GetChildren()) do
if table.find(ValidParts, v.Name) == nil then continue end
print("found in table")
local Particle = Particle115:Clone()
Particle.Parent = child
end
end)
--//Variables
local Particle115 = ServerStorage.kills115
local Character = script.Parent
--//Tables
local ValidParts = {
"Right Arm"
}
--//Functions
local function findStringInTable(tbl, str)
for _, element in pairs(tbl) do
if (element == str) then
return true
end
end
return false
end
for i, child in pairs(Character:GetChildren()) do
print(child)
if findStringInTable(ValidParts, child.Name) then
print("found in table")
local Particle = Particle115:Clone()
Particle.Parent = child
end
end
–//Services
local ServerStorage = game:GetService(“ServerStorage”)
--//Variables
local Particle115 = ServerStorage.kills115
local Character = script.Parent
--//Tables
local ValidParts = {
"Right Arm"
}
--//Functions
for i, child in pairs(Character:GetChildren()) do
print(child)
if ValidParts[child.Name] then
print("found in table")
local Particle = Particle115:Clone()
Particle.Parent = child
end
end
end
end