im2awsm
|
  |
| Joined: 25 Aug 2010 |
| Total Posts: 2295 |
|
|
| 19 Aug 2013 07:25 PM |
So my gun has a script which moves the arms. Like most do, but, when I unequip the gun, the arms stay in that position. I was told it most likely has to do with welds not being removed, but I can't seem to find the source. Here is the script.
Tool = script.Parent; local arms = nil local torso = nil local welds = {}
function Equip(mouse) wait(0.01) arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")} torso = Tool.Parent:FindFirstChild("Torso") if arms ~= nil and torso ~= nil then local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")} if sh ~= nil then local yes = true if yes then yes = false sh[1].Part1 = nil sh[2].Part1 = nil local weld1 = Instance.new("Weld") weld1.Part0 = torso weld1.Parent = torso weld1.Part1 = arms[1] weld1.C1 = CFrame.new(-0.4, 1, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300), 0, math.rad(-85)) welds[1] = weld1 local weld2 = Instance.new("Weld") weld2.Part0 = torso weld2.Parent = torso weld2.Part1 = arms[2] weld2.C1 = CFrame.new(-1, 0.2, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0) welds[2] = weld2 end else print("sh") end else print("arms") end end
function Unequip(mouse) if arms ~= nil and torso ~= nil then local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")} if sh ~= nil then local yes = true if yes then yes = false sh[1].Part1 = arms[1] sh[2].Part1 = arms[2] welds[1].Parent = nil welds[2].Parent = nil end else print("sh") end else print("arms") end end Tool.Equipped:connect(Equip) Tool.Unequipped:connect(Unequip) |
|
|
| Report Abuse |
|
|
im2awsm
|
  |
| Joined: 25 Aug 2010 |
| Total Posts: 2295 |
|
| |
|
im2awsm
|
  |
| Joined: 25 Aug 2010 |
| Total Posts: 2295 |
|
| |
|
gijoe103
|
  |
| Joined: 03 Jun 2013 |
| Total Posts: 82 |
|
|
| 21 Aug 2013 06:47 AM |
| Stop saying bump really guys just stop |
|
|
| Report Abuse |
|
|
|
| 21 Aug 2013 06:55 AM |
| We don't fix free model scripts. |
|
|
| Report Abuse |
|
|
im2awsm
|
  |
| Joined: 25 Aug 2010 |
| Total Posts: 2295 |
|
|
| 21 Aug 2013 04:30 PM |
| Dude. I'm trying to use these scripts to learn. Go on, tell me how to make a gun with reload animations, ammo, and ray casting. Go on then. |
|
|
| Report Abuse |
|
|
im2awsm
|
  |
| Joined: 25 Aug 2010 |
| Total Posts: 2295 |
|
|
| 21 Aug 2013 04:34 PM |
| And look, I'm attempting to learn how to make animations for reloading, and It's going we'll, but I can't continue until I get this fixed. So all this broken script is causing is me not being able to learn more. |
|
|
| Report Abuse |
|
|
im2awsm
|
  |
| Joined: 25 Aug 2010 |
| Total Posts: 2295 |
|
| |
|
Iaku
|
  |
| Joined: 19 Jun 2011 |
| Total Posts: 83 |
|
| |
|