Touch Die Folder

I have a folder in workspace called Damage and everything inside of it is called rd I wanna make a script that access everything in that folder and makes it where if you touch a part it kills you

1 Like

Just refer the folder, get all the children of it, then for loop on it and connect it to a Touched event that kills whoever touches it.

There is a section of Roblox’s Touched Event API that shows you how to do exactly this under ModelTouched.

You just change model to the folder you want instead.

local folder = workspace.KillParts -- Folder
local player = game:GetService('Players')
local partname = 'rd' -- Name of the parts 

for i,v in pairs(folder:GetDescendants()) do
if v.Name == partname then
	v.Touched:Connect(function(hit)
		local player =  player:GetPlayerFromCharacter(hit.Parent)
		player.Character.Humanoid.Health = 0
	end)
end
end
3 Likes