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

Why does this weld script not work?

Asked by 8 years ago

I am working on a rpg and the weld script I use for the swords works fine in studio, but in playing the game for some reason the weld doesnt work. theres no output V my weld script

handle = script.Parent:WaitForChild("Handle")
tool = script.Parent
function weld(part)
    local w1 = Instance.new("Weld")
    w1.Part0 = handle
    w1.Part1 = part
    w1.C0 = handle.CFrame:inverse()
    w1.C1 = part.CFrame:inverse()
    w1.Parent = tool
end

for _, part in pairs (script.Parent:GetChildren()) do
    if part:IsA("BasePart") and part.Name ~= "Handle"then
        weld(part)
    end
end

the model the script is in is in a folder in lighting if that matters

0
You have an extra end. If there is more of the script then you would need local in front of your variables. But that might just be how you posted the question. User#11440 120 — 8y
0
The ends look right to me. GoldenPhysics 474 — 8y
0
You also might want for line 12 "if part:IsA("BasePart") then" GoldenPhysics 474 — 8y
0
Also try setting the parent of the weld last in the function GoldenPhysics 474 — 8y
View all comments (4 more)
0
ok QuantumToast 261 — 8y
0
Ands look a lot like ends xD srry User#11440 120 — 8y
0
Are you welding it every time it is equipped? BlackJPI 2658 — 8y
0
No its not a tool, its a model, the parts are welded to the handle and the handled to the plays arm QuantumToast 261 — 8y

Answer this question