In my game, I have a script where if you touch a part with a value named “kills” in it, it would kill the player. If the value is in a normal part, it would work but if the part is in a part in a player, it doesn’t work.
This is the script that kills the player:
for i, v in pairs(game.Workspace:GetDescendants()) do
if v:IsA("BasePart") then
if v:FindFirstChild("kills") then
v.Touched:Connect(function(touch)
if touch.Parent:FindFirstChild("Humanoid") then
touch.Parent.Humanoid.Health = 0
end
end)
end
end
end
game.Players.LocalPlayer.CharacterAdded:Connect(function(character)
character.Humanoid.Touched:Connect(function(other)
if other:FindFirstChild("kills") then
-- do your damaging in here
end
end)
end)