|
| 02 Mar 2012 09:39 PM |
Am I doing this right?
I welded the players 'Right Arm', and it rotates different; when you look in different directions.
RWeld.C1 = RWeld.C1 * CFrame.Angles(1.57, 0, 0) * CFrame.new(0, -0.5, -0.5) |
|
|
| Report Abuse |
|
SDuke524
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 6267 |
|
|
| 02 Mar 2012 09:46 PM |
1. This obviously isn't the whole script 2. Make sure you read the entire article on welds 3. Explain what it is doing, not just what it's supposed to do |
|
|
| Report Abuse |
|
|
| 02 Mar 2012 10:33 PM |
I want it to rotate the arm, like you equipped a tool.
But it only works when my character is standing in a certain direction.
_G:
function _G.Weld(Obj, Part, Parent) local w = Instance.new("Weld") w.Part0 = Obj w.Part1 = Part w.C0 = CFrame.new() w.C1 = Part.CFrame:inverse() * Obj.CFrame w.Parent = Parent return w end
_G.Body = { _G.Character.Head, _G.Character.Torso, _G.Character["Right Arm"], _G.Character["Left Arm"], _G.Character["Right Leg"], _G.Character["Left Leg"] }
_G.Joints = { _G.Body[2].Neck, _G.Body[2]["Right Shoulder"], _G.Body[2]["Left Shoulder"], _G.Body[2]["Right Hip"], _G.Body[2]["Left Hip"] }
The WHOLE script:
_G.Mouse.KeyDown:connect(function(Key)
if Key == "e" then
if not Equipped then
local Asset = InsertService:LoadAsset(73342006) InsertService:Insert(Asset)
for _, v in pairs(game.Workspace:GetChildren()) do if v:findFirstChild("Pump-Action Shotgun") and Gun == nil then Gun = v["Pump-Action Shotgun"] Gun.Parent = game.Workspace v:Destroy() end end
for _, v in pairs(Gun:GetChildren()) do
local Pass = false
if v.Name == "Main" then ReloadW = _G.Weld(Gun.Tilt, v, Gun.Handle)
elseif v.Name ~= "Main" then for _, k in pairs(Reloading) do if v.Name == k then _G.Weld(Gun.Main, v, Gun.Handle) Pass = true end end end
if not Pass then _G.Weld(Gun.Handle, v, Gun.Handle) end end
for _, v in pairs(Gun:GetChildren()) do v.Anchored = false end
_G.Body[3].Parent = game.Workspace _G.Body[4].Parent = game.Workspace
_G.Joints[2].Part0 = nil _G.Joints[3].Part0 = nil
RWeld = _G.Weld(_G.Body[2], _G.Body[3], Gun.Handle) LWeld = _G.Weld(_G.Body[2], _G.Body[4], Gun.Handle)
RWeld.C1 = RWeld.C1 * CFrame.Angles(1.57, 0, 0) * CFrame.new(0, -0.5, -0.5)
Equipped = true
else
Gun:Destroy() Gun = nil
_G.Joints[2].Part0 = _G.Body[2] _G.Joints[3].Part0 = _G.Body[2]
RWeld:Destroy() LWeld:Destroy()
Equipped = false end
elseif Key == "r" then ReloadW.C1 = ReloadW.C1 * CFrame.Angles(math.rad(-140), 0, 0) end end) |
|
|
| Report Abuse |
|
|
| 02 Mar 2012 10:34 PM |
Missed a chunk from the top of the code:
local InsertService = game:GetService("InsertService")
local Equipped = false local Gun = nil
local ReloadW local RWeld local LWeld
local Reloading = { "Cap", "Hole 1", "Hole 2", "Joint 1", "Joint 2", "Load", "Pump", "Ring 1", "Ring 2", "Space 3", "Tube 1", "Tube 2", "Trigger" } |
|
|
| Report Abuse |
|