SHARE
TWEET

Untitled

a guest Jun 19th, 2017 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local player = game:GetService'Players'.LocalPlayer
  2. local playerInputs =  game:GetService'UserInputService'
  3. local connections = {}
  4. local character = player.Character
  5. --wfc short for WaitForChild
  6. local function wfc(parent, child)
  7.     return parent:WaitForChild(child)
  8. end
  9. local torso = wfc(character, 'Torso')
  10. local camera = wfc(workspace, 'Camera')
  11. --player.CameraMode = Enum.CameraMode.LockedFirstPerson
  12. --o short for object
  13. local function o(instanceName)
  14.     local instance = Instance.new(instanceName)
  15.     return (function(properties)
  16.         for property, value in next, properties do
  17.             instance[property] = value
  18.         end
  19.         return instance
  20.     end)
  21. end
  22. --v3 short for Vector3
  23. v3 = Vector3.new
  24. --cf short for CFrame
  25. cf = CFrame.new
  26. --ca short for CFrame Angles
  27. ca = CFrame.Angles
  28. --bc short for BrickColor
  29. bc = BrickColor.new
  30. --rad short for Radians
  31. rad = math.rad
  32. --cos short for Cosine
  33. cos = math.cos
  34. --sin short for Sine
  35. sin = math.sin
  36. --abs short for Absolute Value
  37. abs = math.abs
  38. --
  39. wfc(character, 'Animate').Disabled = true
  40. if camera:FindFirstChild('Client') then
  41.     camera.Client:Destroy()
  42. end
  43. local clientView = o'Model'{
  44.     Name = 'Client',
  45.     Parent = camera
  46. }
  47. local fakeLeftArm = o'Part'{
  48.     Name = 'Fake Left Arm',
  49.     Parent = clientView,
  50.     Anchored = false,
  51.     CanCollide = true,
  52.     TopSurface = 1,
  53.     BottomSurface = 0,
  54.     BrickColor = bc('Wheat'),
  55.     Material = 'SmoothPlastic',
  56.     Size = v3(1, 2, 1)
  57. }
  58. local fakeRightArm = fakeLeftArm:Clone()
  59. fakeRightArm.Name = 'Fake Right Arm'
  60. fakeRightArm.Parent = clientView
  61. local weldLA = o'Weld'{
  62.     Name = 'Fake Left Arm Weld',
  63.     Parent = fakeLeftArm,
  64.     Part0 = torso,
  65.     Part1 = fakeLeftArm,
  66.     C0 = cf(-1.5, 0.5, -0.75) * ca(rad(90), 0, 0)
  67. }
  68. local weldRA = o'Weld'{
  69.     Name = 'Fake Right Arm Weld',
  70.     Parent = fakeRightArm,
  71.     Part0 = torso,
  72.     Part1 = fakeRightArm,
  73.     C0 = cf(1.5, 0.5, -0.75) * ca(rad(90), 0, 0)
  74. }
  75. --
  76. for i = 0, 360 do
  77.     weldLA.C1 = cf() * ca(rad(i), 0, 0)
  78. end
  79.  
  80. connections['onInput'] = playerInputs.InputBegan:Connect(function(input, onUI)
  81.     --[[
  82.     Enum.UserInputType
  83.     Keyboard, MouseButton1, MouseButton2, MouseButton3, Touch, Gamepad1, MouseWheel
  84.     ]]--
  85. end)
  86. connections['deadInput'] = playerInputs.InputEnded:Connect(function(input, onUI)
  87.  
  88. end)
  89.  
  90. connections['changedInput'] = playerInputs.InputChanged:Connect(function(input, onUI)
  91.     local inputType = input.UserInputType
  92.     if inputType == Enum.UserInputType.MouseMovement then  
  93.         local cameraFrame = camera.CoordinateFrame
  94.         local direction = cameraFrame.lookVector
  95.         local yaw = math.atan2(direction.x, -direction.z)
  96.         local pitch = math.atan(math.sqrt(math.pow(direction.x, 2) + math.pow(direction.z, 2)) / direction.y)
  97.         weldLA.C1 = cf() * ca(cos(pitch) * (pitch > 0 and -1 or 1), 0, 0)
  98.         weldRA.C1 = weldLA.C1
  99.     end
  100. end)
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top