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

Why is this welding script not working right?

Asked by 9 years ago

I have a welding script inside of multiple tools that works perfectly fine. The only problem is that, when a character is manually loaded and the tools are given to the player, the welding goes crazy and parts are no longer welded correctly.

Here is a video example: https://www.youtube.com/watch?v=qEmX_D0Wr34

This makes no sense because the script that gives the player the tools when bought via the surfacegui and the script that gives the player the tools when the player respawns are EXACTLY the same when it comes to cloning the tools and giving them to the player, yet when the player goes to buy a gun after the player resets, the welding script works fine. I even tried putting a 5 second wait and the same thing still occurs. Here's the actual welding script:

local t = script.Parent
local h = t.Handle
local e = {}

for i,v in pairs(t:GetChildren()) do
    if v:IsA("BasePart") then
        local w = Instance.new("Weld", game.JointsService)
        w.C1 = v.CFrame:toObjectSpace(h.CFrame)
        w.Part0 = h
        w.Part1 = v
        table.insert(e, w:Clone())
    end
end

script.Parent.Equipped:connect(function()
    for i,v in pairs(e) do
        v:Clone().Parent = game.JointsService
    end
end)

1 answer

Log in to vote
0
Answered by 9 years ago

Is the part anchored? I wish i could have added this as a comment its not an answer im sorry.

Ad

Answer this question