Updated = 1
local h = script.Parent local g = script.Parent.Parent local hm = nil for i,v in pairs (g:GetChildren()) do if (v ~= h) and (v.ClassName == "Part") then v.Name = "Part"..i-1 hm = i end end wait(1) for i=1,hm do p = g["Part"..i] P0 = CFrame.new(h.Position.X,h.Position.Y,h.Position.Z) P1 = CFrame.new(p.Position.X,p.Position.Y,p.Position.Z) w = Instance.new("Weld", h) w.C0 = P0 w.Part0 = h w.C1 = P1 w.Part1 = p end
This makes welding parts alot more faster. But theres a small problem. When the script runs, the parts that are associated to this script just bugs around. Can someone please help me fix this bug??
I edited it a bit.
local h = script.Parent local g = script.Parent.Parent local hm = nil for i,v in pairs (g:GetChildren()) do --starts for loop to list the parts if (v ~= h) and (v.ClassName == "Part") then -- if the block that was listed is not h then hm = i -- makes how many parts are inside the model end end wait(1) for i=1,hm do -- starts for loop p = g["Part"..i] --names p to the part w = Instance.new("Weld", h) -- makes a weld w.C0 = CFrame.new(h.Position.X,h.Position.Y,h.Position.Z)-- position of h w.Part0 = h -- what is part0 (h) w.C1 = CFrame.new(p.Position.X,p.Position.Y,p.Position.Z) --position of p w.Part1 = p -- what is part1(p) end
It may still not work I saw 1 small thing.