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

How can i make a part attached to the tip of the arm?

This way certainly doesn't work:

wait(0.1)

local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
local Anim = script.Animation

Mouse.KeyDown:connect(function(key)
if key == "r" then
local s = player.Character.Humanoid:LoadAnimation(Anim)
s:Play()

local fc = Instance.new("Part")
fc.Shape = "Block"
fc.Size = Vector3.new(10 , 10 , 1)
fc.Parent = player.Character
fc.CanCollide = false


local weld = Instance.new("Weld")
weld.Part0 = fc
weld.Part1 = player.Character:FindFirstChild("RightGripAttachment")
weld.C0 = weld.C0*CFrame.new(0, 0, 2) 
weld.Parent = fc


end
end)

1 comment

0

KeyDown is deprecated...

1 answer

✓ Accepted answer

First of all your script will not work if you ever decide to turn on Filtering Enabled, the Mouse object can only be accessed through a Local Script (Client Side), and manipulating parts in the Workspace can only be on Script (Server Side). But besides that point, I would recommend if you are simply just trying to attach a part to the tip of a player's arm (or the hand) that you use the new Roblox WeldConstraint.

Your code doesn't work because you are trying to set Part1 of your weld to something that isn't a Part. With the Weld or WeldConstraint you set Part0 to the base part (or parent of Weld/WeldConstraint) and Part1 to the connecting part.

If using the WeldConstraint you would need to pre-orientate the part you are attaching, but with the Weld you would be able to use the C0/C1 properties.

You want your Part1 to likely be the Character.RightHand.

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