| |
|
| |
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 05 Apr 2015 05:58 PM |
Messing with the joint motors.
I script -~ chimmihc |
|
|
| Report Abuse |
|
|
| |
|
Tuneable
|
  |
| Joined: 16 Feb 2013 |
| Total Posts: 2932 |
|
|
| 05 Apr 2015 06:08 PM |
Hacky but works
repeat wait(1) until game.Players.LocalPlayer repeat wait(1) until game.Players.LocalPlayer.Character
local Workspace = workspace local Player = game.Players.LocalPlayer local Character = Player.Character local Tool = script.Parent local Head = Character:WaitForChild("Head") local Camera = Workspace.CurrentCamera local Torso = Character:WaitForChild("Torso") local Equipped = false
local RenderStepped
local ArmPart = Character.Torso:clone() ArmPart:ClearAllChildren() ArmPart.Transparency = 1 ArmPart.Name = "FakeTorso"
local FakeHead = Character.Head:clone() FakeHead:ClearAllChildren() FakeHead.Name = "FakeHead" FakeHead.FormFactor = "Custom" FakeHead.Transparency = 1 FakeHead.Size = Vector3.new(.1, .1, .1)
Tool.Equipped:connect(function(Mouse) Equipped = true ArmPart.Parent = Character FakeHead.Parent = Character Character.Torso["Right Shoulder"].Part0 = ArmPart Character.Torso["Left Shoulder"].Part0 = ArmPart local ArmWeld = Instance.new("Weld", ArmPart) ArmWeld.Part0 = ArmPart ArmWeld.Part1 = FakeHead ArmWeld.C0 = CFrame.new(0, 2, 0) local HeadWeld = Instance.new("Weld", FakeHead) HeadWeld.Part0 = Torso HeadWeld.Part1 = FakeHead HeadWeld.C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) HeadWeld.C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) while (Equipped == true) do game:GetService("RunService").RenderStepped:wait() HeadWeld.C0 = CFrame.new(0, 1.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) * CFrame.Angles(-math.asin(Camera.CoordinateFrame.lookVector.Y) ,0, 0) end end)
Tool.Unequipped:connect(function() Equipped = false ArmPart.Parent = nil FakeHead.Parent = nil Character.Torso["Right Shoulder"].Part0 = Torso Character.Torso["Left Shoulder"].Part0 = Torso end)
|
|
|
| Report Abuse |
|
|
|
| 05 Apr 2015 06:16 PM |
| Your name makes me m0ist @OP |
|
|
| Report Abuse |
|
|
| |
|
|
| 05 Apr 2015 08:02 PM |
Look into some of these scripts I made:
http://www.roblox.com/ViewModel-item?id=225498799 http://www.roblox.com/Realism-Mode-Script-item?id=189240277 |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2015 08:05 PM |
This one is fun. You need to make the bottom surface point at the mouse, but you also need to manage the weld correctly. Fun time. Let's get started!
We first need to make a function to point the bottom surface at a position.
function PointBottomSurface(Pos, LookAt) local Up = Vector3.new(0,1,0); local DirectionToLookAt = (LookAt-Pos).unit; if (DirectionToLookAt.Y > 0.98) then -- This means the direction to look at is the same as the 'Up' -- This won't work. Let's just change the 'Up' to something else Up = Vector3.new(1,0,0); end local XAxis = DirectionToLookAt:Cross(Up) local Up = XAxis:Cross(DirectionToLookAt); return CFrame.new( Pos.X,Pos.Y,Pos.Z, -XAxis.X,-DirectionToLookAt.X,-Up.X, -XAxis.Y,-DirectionToLookAt.Y,-Up.Y, -XAxis.Z,-DirectionToLookAt.Z,-Up.Z ); end
Now we simply need to make the line of code that uses that function, and turns the resulting CFrame into object-space to work with the "Right Shoulder" weld.
local RightShoulder = Player.Character.Torso['Right Shouldern']; Game:GetService("RunService").RenderStepped:connect(function() RightShoulder.C1 = (PointBottomSurface(RightShoulder.Part1.Position, Mouse.Hit.p)):toObjectSpace(RightShoulder.Part0.CFrame * RightShoulder.C0) end)
Combining all that, this will point the arm at the mouse. |
|
|
| Report Abuse |
|
|