Trying to make the designated “killpart” kill a player if their name is inside the table known as punishedplayer. I honestly have no idea how to do this so feel free to rewrite the whole script if you need to. I just wanted to attempt it before posting here.

local PunishedPlayers = {"Mysterial_12"}
local Killpart = script.Parent
Killpart.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChildWhichIsA("Humanoid") then
local Target = Hit.Parent
if table.find(PunishedPlayers, Target.Name) then
Target.Humanoid.Health = 0
end
end
end)
1 Like
Just curious, whats the difference between FindFirstChild and FindFirstChildWhichIsA?
FindFirstChildWhichIsA(“Part”) will find the first child which is a Part
FindFirstChild(“Part”) will find the first child with the name “Part”
1 Like