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

Whats wrong with this weld script?

Asked by 9 years ago

The gun I am welding won't appear on my characters right arm. This is a LocalScript in a hopperbin

player = game.Players.LocalPlayer

ra = player.Character:WaitForChild("Right Arm")

humanoid = player.Character.Humanoid

gun = game.Lighting.Flintlock

Tool = script.Parent

Tool.Selected:connect(function()
    gun:Clone()
    gun.Parent = script.Parent  
        local Weld = Instance.new("Weld")
        Weld.Part0 = ra
        Weld.C0 = ra.CFrame:inverse()
        Weld.Part1 = script.Parent.Flintlock
        Weld.C1 = script.Parent.Flintlock.CFrame:inverse()
        Weld.Parent = script.Parent.Flintlock
        script.Parent.Flintlock.CFrame = ra.CFrame * CFrame.new(0,0,-1)
        script.Parent.Flintlock.Anchored = false
end)

0
I don't know much about welds, but try positioning it with the CFrame before setting the weld c0/c1 User#6546 35 — 9y
0
I didn't work :/ Thanks for the feedback though. kingstephen23 35 — 9y
0
You shouldn't try repositioning the object after the object is welded, it will break the weld so you should reposition the object before you weld it. UserOnly20Characters 890 — 9y

Answer this question