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

Can someone help me with my weld script? The problem is that it breaks.

Asked by
Tan0ak 28
4 years ago
Edited 4 years ago

so when I hold my tool it works just fine with the weld script. But when buy the tool from the shop the weld breaks and it scatters everywhere. Plz help me.

my weld script:

local prev 
local parts = script.Parent:GetChildren() 

for i = 1,#parts do 
    if (parts[i].className == "Part" or parts[i].className == "UnionOperation") then 
        if (prev ~= nil)then 
            local weld = Instance.new("Weld") 
            weld.Part0 = prev 
            weld.Part1 = parts[i] 
            weld.C0 = prev.CFrame:inverse() 
            weld.C1 = parts[i].CFrame:inverse() 
            weld.Parent = prev 
        end 
        prev = parts[i] 
    end 
end

my shop script:

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Down:Connect(function()
    if player.leaderstats.Cash.Value >= 60 then 
        player.leaderstats.Cash.Value = player.leaderstats.Cash.value - 10
        game.ReplicatedStorage.Weapons.SithSaber:Clone().Parent = player:WaitForChild("Backpack")
    end
end)
0
Please validly use the code block as I cannot help you at all with your script all messed up like this. ghxstlvty 133 — 4y
0
ok Tan0ak 28 — 4y
0
does this help? Tan0ak 28 — 4y
1
So I'd assume that your cloning the tool on the client and the weld script is a server script so it won't run mybituploads 304 — 4y

1 answer

Log in to vote
0
Answered by
enes223 327 Moderation Voter
4 years ago

Don't use localscripts.

Ad

Answer this question