Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make a table that creates multiple parts with the same name?

Asked by 4 years ago
Edited 4 years ago

Like the title suggests, I'm trying to create a script where I'm using a table to create multiple parts that share the same name. This is the script I tried:

local EpicPart = Instance.new("Part")


Table1 = {EpicPart,EpicPart,EpicPart}

a = 30

for i,v in pairs (Table1) do
    v.Parent = game.Workspace
    v.Position = Vector3.new(0,0,a)
    a = a + 5
    v.Anchored = true
    v.CanCollide = true
    v.Touched:Connect(function(hit)
    local humanoid = hit.Parent:FindFirstChild("Humanoid")
    if humanoid then humanoid.Health = humanoid.Health - 100



end


    end)



end

1 answer

Log in to vote
0
Answered by 4 years ago

Okay so I found the answer, all I had to do was put "v:Clone().Parent = game.Workspace"

Ad

Answer this question