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

Why the parts of this fast and easy welding script bugs?

Asked by 10 years ago

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??

1 answer

Log in to vote
0
Answered by 10 years ago

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.

0
Thanks for trying to help, but the parts still bug, i already changed a but the script DragonOfWar900 397 — 10y
Ad

Answer this question