Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What's wrong with my weld script?

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

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.

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.