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 » Scripting Helpers
Home Search
 

Re: Welding Help

Previous Thread :: Next Thread 
Kondou is not online. Kondou
Joined: 05 Aug 2012
Total Posts: 1148
28 Mar 2013 05:48 PM
I made a gun over the course of last week to today, it works perfect, until I added my weld to the gunscript so I can do animations, now it kills you almost every time you equip it, help?

------Locals at top of script
local NewInstance = Instance.new
local NewCFrame = CFrame.new
local NewVector3 = Vector3.new
local arms = ni
local legs = nil
local torso = nil
local othertorso = nil
local rightweld = nil
local leftweld = nil
local welds = {} .
local hi = {}
local sh = {}
local Tool = script.Parent
----------------------------

----Weld is at the onEquipped(mouse) function so it works whenever you equip
arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
legs = {Tool.Parent:findFirstChild("Left Leg"), Tool.Parent:FindFirstChild("Right Leg")}
torso = Tool.Parent:FindFirstChild("Head")
othertorso = Tool.Parent:findFirstChild("Torso")

if arms ~= nil and torso ~= nil and legs ~= nil then
sh = {othertorso:FindFirstChild("Left Shoulder"), othertorso:FindFirstChild("Right Shoulder"), othertorso:findFirstChild("Neck")}
hi = {othertorso:FindFirstChild("Left Hip"), othertorso:findFirstChild("Right Hip")}
if sh[1] and sh[2] and sh[3] and hi[1] and hi[2] then

local weld1B = NewInstance("Weld")
weld1B.Part0 = othertorso
weld1B.Parent = othertorso
weld1B.Part1 = nil
weld1B.C1 = NewCFrame(-0.5, -2, 0)
legs[1].Name = "Left Leg"
legs[1].CanCollide = true
welds[6] = weld1B
local weld2B = NewInstance("Weld")
weld2B.Part0 = othertorso
weld2B.Parent = othertorso
weld2B.Part1 = nil
weld2B.C1 = NewCFrame(0.5, -2, 0)
legs[2].Name = "Right Leg"
legs[2].CanCollide = true
welds[7] = weld2B

sh[1].Part1 = nil

local weld1 = NewInstance("Weld") --Left Arm
weld1.Part0 = torso
weld1.Parent = torso
weld1.Part1 = arms[1]
weld1.C0 = NewCFrame(-0.2, -1.3, -1.5) * CFrame.Angles(math.rad(90), 0, math.rad(20))
welds[1] = weld1
sh[2].Part1 = nil
local weld2 = NewInstance("Weld") --Right Arm
weld2.Part0 = torso
weld2.Parent = torso
weld2.Part1 = arms[2]
weld2.C0 = NewCFrame(0.6, -1.3, -0.2) * CFrame.Angles(math.rad(90), 0, math.rad(-5))
welds[2] = weld2
sh[3].Part1 = nil
local weld3 = NewInstance("Weld")
weld3.Part0 = othertorso
weld3.Parent = othertorso
weld3.Part1 = torso
weld3.C0 = NewCFrame(0, 1.5, 0)
welds[5] = weld3
Report Abuse
Kondou is not online. Kondou
Joined: 05 Aug 2012
Total Posts: 1148
28 Mar 2013 06:07 PM
Bump
Report Abuse
kert109 is not online. kert109
Joined: 31 Dec 2009
Total Posts: 681
28 Mar 2013 06:19 PM
So your saying as soon as you equip your weapon, you just... Die? :o
Report Abuse
Kondou is not online. Kondou
Joined: 05 Aug 2012
Total Posts: 1148
28 Mar 2013 06:24 PM
Most of the time yes.

Though I just found this does not occur with guns of smaller sizes, only happens with my MP5 and my big boy toy M60
Report Abuse
Kondou is not online. Kondou
Joined: 05 Aug 2012
Total Posts: 1148
28 Mar 2013 06:29 PM
Got it, added a wait(0.02) at the top of the weld, oddly enough it worked.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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