I wish to make a folder in Workspace containing all of the kill bricks, which themselves do not carry any scripts.
I placed the kill script in ServerScriptService, and placed an ObjectValue in the script. Though I am having issues with doing so because it’s not killing the player whenever stepping on a brick inside the folder.
local killscript = script.Folder.Value
script.killscript.Touched:connect(function(hit)
if hit and hit.Parent and hit.Parent:FindFirstChild(“Humanoid”) then
hit.Parent.Humanoid.Health = 0
end
end)
your doing script.killscript when you declared killscript already as the value of the object value you need to do killscript.Touched not script.killscript
local killscript = script.Folder.Value
killscript.Touched:connect(function(hit)
if hit and hit.Parent and hit.Parent:FindFirstChild(“Humanoid”) then
hit.Parent.Humanoid.Health = 0
end
end)
if you did your organization correct it should work
local f = script.Folder
for _, v in pairs(f) do
if v:IsA("BasePart") then
v.Touched:Connect(function(h)
if h.Parent:FindFirstChild("Humanoid") then
h.Parent.Humanoid.Health = 0
end
end)
end
end
Basically iterate through the folder.