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

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

Asked by
Echtic 128
5 years ago

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)

0
KeyDown is deprecated... User#19524 175 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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.

Ad

Answer this question