generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Welding arms to head & rotating neck joint?

Previous Thread :: Next Thread 
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
24 Jun 2016 05:20 PM
In the following script, I weld the player's arms to the torso, then rotate shoulder joints to make their arms follow the camera. How can I instead weld them to the head and use the neck joint for the same effect?


local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
local character = player.Character or player.CharacterAdded:wait()
local torso = character:WaitForChild("Torso")
local arm1 = character:WaitForChild("Left Arm")
local arm2 = character:WaitForChild("Right Arm")
local lShoulder = torso:WaitForChild("Left Shoulder")
local rShoulder = torso:WaitForChild("Right Shoulder")

weld1 = Instance.new("Weld", torso)
weld1.C0 = CFrame.new(-1.5,.5,0)
weld1.Part1 = arm1

weld2 = Instance.new("Weld", torso)
weld2.C0 = CFrame.new(1.5,.5,0)
weld2.Part1 = arm2

local offset = CFrame.new(0,0,-0.5)*CFrame.Angles(math.pi/2,0,0)
local yz = Vector3.new(0,1,1)
local function FPS_Arms()
arm1.LocalTransparencyModifier = 0
arm2.LocalTransparencyModifier = 0
local tCFrame, hit = torso:GetRenderCFrame(), mouse.Hit.p
local p0c0 = tCFrame*weld1.C0
weld1.C1 = (CFrame.new(p0c0.p, p0c0*(p0c0:inverse()*hit*yz))*offset):inverse()*p0c0
local p0c0 = tCFrame*weld2.C0
weld2.C1 = (CFrame.new(p0c0.p, p0c0*(p0c0:inverse()*hit*yz))*offset):inverse()*p0c0
end

local function CameraModeChanged(prop)
if prop ~= "CameraMode" then return end
if player.CameraMode == Enum.CameraMode.LockFirstPerson then
game:GetService("RunService"):BindToRenderStep("FPS_Arms", Enum.RenderPriority.First.Value, FPS_Arms)
lShoulder.Part0 = nil
rShoulder.Part0 = nil
weld1.Part0 = torso
weld2.Part0 = torso
else
game:GetService("RunService"):UnbindFromRenderStep("FPS_Arms")
lShoulder.Part0 = torso
rShoulder.Part0 = torso
weld1.Part0 = nil
weld2.Part0 = nil
end
end

player.Changed:connect(CameraModeChanged)
CameraModeChanged("CameraMode")



Report Abuse
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
24 Jun 2016 07:09 PM
1


Report Abuse
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
24 Jun 2016 09:46 PM
2


Report Abuse
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
25 Jun 2016 01:58 AM
3


Report Abuse
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
25 Jun 2016 01:10 PM
4


Report Abuse
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
26 Jun 2016 01:18 AM
5


Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
26 Jun 2016 01:24 AM
HELLO YOU'RE SCIRPT YOUR LOOK FOR IS NOT THIS!!!!!!!! WRONG ONE.. DO THIS


WELD(ARMS TO HEAD)
WHILE NOT FALSE DO WHILE TRUE DO WAIT(ROTATE NECK) END END


#code R+ | local RAP = "R$726,102"; local robux = "R$11,041";
Report Abuse
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
26 Jun 2016 11:52 PM
thank`s


Report Abuse
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
27 Jun 2016 01:32 AM
bump


Report Abuse
exoSentinel is not online. exoSentinel
Joined: 18 Mar 2012
Total Posts: 2795
27 Jun 2016 01:33 AM
when your too good for almost everyone on this forum
Report Abuse
HexC3D is not online. HexC3D
Joined: 30 Jun 2012
Total Posts: 10044
27 Jun 2016 02:37 AM
I always just weld things to the torso..

Last time I tried welding the head some funky stuff happened.
Report Abuse
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
27 Jun 2016 02:51 AM
I can't weld to the torso, because I need this animation to occur in unison with ROBLOX animations which use torso welds


Report Abuse
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
27 Jun 2016 08:47 PM
bump


Report Abuse
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
28 Jun 2016 12:37 AM
b1


Report Abuse
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
28 Jun 2016 01:18 AM
b2


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image