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

What's wrong with my weld script?

Asked by 8 years ago

I'm trying to weld a gun to my characters hand in a hopperbin. The gun won't appear. This is in a local script.

player = game.Players.LocalPlayer

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

Tool = script.Parent

Tool.Selected:connect(function()

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

2 answers

Log in to vote
0
Answered by 8 years ago

HopperBins can not use parts like normal Tools.

I will edit my answer if I am wrong.

Also, you need to explain your question better, because my answer is possibly not what you were meaning to ask. Please don't downvote my answer because of that.

Ad
Log in to vote
0
Answered by
Voltoxus 248 Moderation Voter
8 years ago
local mouse = game.Players.LocalPlayer:GetMouse()

function Equip()
 -- Put Equip Here
end

function KeyUp(key)
if key == "1" then
Equip()
end
end

mouse.KeyUp:connect(KeyUp)

That's what I would do if you really wanted to use a hopper bin.

Answer this question