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

Trying to CFrame MeshPart relative to arm?

Asked by 4 years ago

I have been trying to attach a MeshPart to the outside a player's left arm once they touch a brick, the brick inserts the MeshPart into the local player's humanoid and the local script inside of it makes the MeshPart(a shield) move relative to the player's left arm which works fine. The problem arises when I try to rotate the shield after it's position has been changed, no matter what line I put in it does not change the angle whatsoever.

I am very new to scripting and would appreciate any advice or tips I could get on other things like if it would be better to use a Weld over a WeldConstraint for the shield for my situation,thanks.

local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = game.Players.LocalPlayer.Character.Humanoid
local innershield = game.Players.LocalPlayer.Character.Humanoid.CaptainAmericaShieldNew
local LLArm = game.Players.LocalPlayer.Character.LeftLowerArm


wait(1)

if 1==1
then
wait(1)
innershield.WeldConstraint.Part0 = LLArm
innershield.WeldConstraint.Part1 = innershield

wait(0.01)
innershield.Position = character.LeftLowerArm.Position+Vector3.new(2,1,-2)
wait(0.01)
innershield.CFrame = innershield.CFrame * CFrame.Angles(math.rad(0), math.rad(0), math.rad(90)) 



end

https://imgur.com/63YQa2y

Answer this question