Currently I’m a newbie at scripting and I wish to know how I could make a shortened way of controlling many kill Parts for an obby. Instead of making 20 kill Parts and 20 functions to activate it, how would I be able to make it into 1 function to control 20 kill parts. Am I supposed to use :GetChildren() or something? Sorry if I didn’t explain this as detailed but help would be appreciated.
1 Like
Yes, use :GetChildren()
with a for
loop.
local parts = workspace:GetChildren() --example
for _,v in pairs(parts) do
v.Transparency = 1 --example, you can change this to do whatever
end
1 Like
A simple way would be a folder where you store all the killparts and then just loop through and connect the Touched event to each part
Example
local parts = workspaces.Killparts
for _, part in pairs(parts:GetChildren()) do
part.Touched:Connect(function(hit)
--Your kill code
end)
end
Where Killparts
is the name of the folder where you put all the parts that kill you
2 Likes