Basically, I want to make it, that the parts that are in the Maps, everytime they touch part, they are supposed to die
Error: Touched is not a valid member of Folder This line: map.Touched:Connect(function(hit)
--load map
local mapsStorage = game.ServerStorage.Maps:GetChildren()
local randomMapChoser = mapsStorage[math.random(1, #mapsStorage)]
print("The Random map is: "..randomMapChoser.Name)
local randomMapClone = randomMapChoser:Clone()
randomMapClone.Parent = workspace.currentMap
-- kill players when touch map
local mapsParts = mapsStorage
for _, map in pairs(mapsParts) do
map.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Character.Humanoid.Health = 0
end
end)
end

1 comment
You could include a value inside each part that says if it should kill the player. Then if it was touched check that value. But that's a terrible way so don't do that lol.