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 Issue

Previous Thread :: Next Thread 
salem9 is not online. salem9
Joined: 25 Oct 2008
Total Posts: 23312
18 Jul 2011 10:19 PM
local Welds = {}
local WeldClones = {}
local Handle = script.Parent.Handle

for i,v in pairs(script.Parent:GetChildren()) do
if v:IsA("BasePart") then
if v.Name ~= "Handle" then
local w = Instance.new("Weld")
w.Part0, w.Part1 = Handle, v
w.C1 = w.Part1.CFrame:toObjectSpace(w.Part0.CFrame)
w.Parent = Game.JointsService
if v.Name == "RightArm" then
w.Name = "" ..script.Parent.Parent.. "RightArm"
elseif v.Name == "LeftArm" then
w.Name = "" ..script.Parent.Parent.. "LeftArm"
table.insert(Welds, w)
table.insert(WeldClones, w:Clone())
end
end
end
end

script.Parent.Equipped:connect(function()
for i,v in pairs(WeldClones) do
v:Clone().Parent = Game.JointsService
end
end)


No output, but when first selected the brick named RightArm doesn't weld, and the second time selected the LeftArm brick doesn't weld.
Report Abuse
TimeOF is not online. TimeOF
Joined: 14 Jun 2011
Total Posts: 129
18 Jul 2011 10:24 PM
local Welds = {}
local WeldClones = {}
local Handle = script.Parent.Handle

for i,v in pairs(script.Parent:GetChildren()) do
if v:IsA("BasePart") then
if v.Name ~= "Handle" then
local w = Instance.new("Weld")
w.Part0,Part1 = Handle, v
w.C1 = Part1.CFrame:toObjectSpace(Part0.CFrame)
w.Parent = Game.JointsService
if v.Name == "RightArm" then
w.Name = "" ..script.Parent.Parent.. "RightArm"
elseif v.Name == "LeftArm" then
w.Name = "" ..script.Parent.Parent.. "LeftArm"
table.insert(Welds, w)
table.insert(WeldClones, w:Clone())
end
end
end
end

script.Parent.Equipped:connect(function()
for i,v in pairs(WeldClones) do
v:Clone().Parent = Game.JointsService
end
end)

Not sure but i took a stab in the dark :/ It could be u cant have a variable inside of another variable ((Like so)) Example:w.part,w.part,w.part
I dont think that is right but i might be wrong.
Report Abuse
salem9 is not online. salem9
Joined: 25 Oct 2008
Total Posts: 23312
18 Jul 2011 10:33 PM
What did you change? I can't find a difference in the two scripts.
Report Abuse
TimeOF is not online. TimeOF
Joined: 14 Jun 2011
Total Posts: 129
18 Jul 2011 10:47 PM
I removed the w. variable that is inside the other w.
Report Abuse
salem9 is not online. salem9
Joined: 25 Oct 2008
Total Posts: 23312
18 Jul 2011 10:59 PM
That breaks the script. Part1 can't be found since it's heirarchy isn't defined earlier.
Report Abuse
salem9 is not online. salem9
Joined: 25 Oct 2008
Total Posts: 23312
18 Jul 2011 11:26 PM
Bump
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