Alright so I'm trying to make my ROBLOXian have a certain arm angle, 2 seconds after I join the game. The problem is It's not staying connected to the character. I've tried to anchor it, but it just falls off the map. How Would I make it stick to my player?
The script is inside of StarterPack:
01 | wait( 2 ) |
02 | x = script.Parent.Parent.Name |
03 | player = game.Workspace:FindFirstChild(x):GetChildren() |
04 | if player ~ = nil then |
05 | for i = 1 ,#player do |
06 | if player [ i ] :IsA( "Part" ) then |
07 | if player [ i ] .Name = = "Left Arm" then |
08 | player [ i ] .Position = Vector 3. new (- 0.699999928 , 3.4000001 , - 0.699999988 ) |
09 | player [ i ] .Rotation = Vector 3. new ( 90.0000076 , 1.67182443 e- 005 , 45 ) |
10 | end |
11 | end |
12 | end |
13 | end |
Just go get the left arm like you usually would:
1 | local x = script.Parent.Parent.Name |
2 | game.Workspace:FindFirstChild(x) [ "Left Leg" ] |
3 | game.Workspace:FindFirstChild(x):FindFirstChild( "Left Leg" ) |
4 | game.Workspace:FindFirstChild(x):WaitForChild( "Left Leg" ) |
Use CFrame instead of changing the Position and rotation.
1 | part.CFrame = CFrame.new( 0 , 10 , 0 ) * part.CFrame.Angles( 0 , 0 ,math.rad( 90 )) |
1 | wait( 2 ) |
2 | local player = script.Parent.Parent.Character --If script.Parent.Parent is a player, we can get the character by doing ".Character". |
3 | local arm = player [ "Left Leg" ] |
4 | arm.CFrame = CFrame.new(- 0.699999928 , 3.4000001 , - 0.699999988 ) * CFrame.Angles(math.rad( 90.0000076 ), math.rad( 1.67182443 e- 005 ), math.rad( 45 )) |
5 | --arm.Anchored = true --Do this if the arm falls off... |
Hope it helps!