How can I move a part while still keeping it welded to the player?
Hi, sorry if the title is completely misleading, I’m really not sure how to word this problem. Basically, I’m creating a prototype extendable shield welded to the players left arm.
The shield model’s structure can be seen here:
https://imgur.com/a/SdjieYq
as well as the in game view once welded:
https://imgur.com/a/5UHguSV
What I am trying to create is a system where the outermost piece of the shield (marked with the sad face) extends upwards while still moving with the player as it walks around.
Here is weld to player script:
01 | print (player, hasgear) |
02 | if hasgear = = false then |
03 | gear = shieldgroup:clone() |
04 | gear.Handle.CFrame = workspace:WaitForChild(player.Name) [ "Left Arm" ] .CFrame * CFrame.new(- 0.20616293 , - 0.415015221 , - 0.040222168 , 1 , 0 , 0 , 0 , 0.999999881 , 0 , 0 , 0 , 1 ) |
05 | gear.par 2. CFrame = gear.Handle.CFrame * CFrame.new( 0.539999008 , 0.160001278 , 0 , 1 , 0 , 0 , 0 , - 1 , 0 , 0 , 0 , - 1 ) |
06 | gear.Parent = player.Character |
07 | local weld = Instance.new( "Weld" ) |
08 | weld.Part 0 = gear.Handle |
09 | weld.C 0 = gear.Handle.CFrame:Inverse() |
10 | weld.Part 1 = game.Workspace [ player.Name ] [ "Left Arm" ] |
11 | weld.C 1 = game.Workspace [ player.Name ] [ "Left Arm" ] .CFrame:Inverse() |
12 | weld.Parent = gear.Handle |
13 | local weld 2 = Instance.new( "Weld" ) |
14 | weld 2. Part 0 = gear.par 2 |
15 | weld 2. C 0 = gear.Handle.CFrame:Inverse() |
16 | weld 2. Part 1 = gear.Handle |
17 | weld 2. C 1 = gear.par 2. CFrame:Inverse() |
18 | weld 2. Parent = gear.par 2 |
My question is what system can I use to extend the outermost layer upwards relative to the inner most one while still having it move with the player. I have attempted to tween the part itself with tweenService, but that requires breaking the weld. I am unfamiliar with weld constraints but when I attempted to use them on this project, I did not understand how to properly offset the pieces from one another. Any and all help is appreciated.