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: Can someone weld this?

Previous Thread :: Next Thread 
KodakKid3 is not online. KodakKid3
Joined: 25 Dec 2008
Total Posts: 2860
21 Mar 2014 09:24 PM
I have a gun that works and stuff, but isn't welded, so it falls apart. I don't know how to weld it, can someone help?

http://www.roblox.com/PhaserPistol-item?id=150510684

Thanks
Report Abuse
IceSIipper is not online. IceSIipper
Joined: 23 Mar 2013
Total Posts: 10447
21 Mar 2014 09:26 PM
just put this script in the tool vvv

local prev
local parts = script.Parent:GetChildren()

for i = 1,#parts do
if (parts[i].className == "Part") or (parts[i].className == "WedgePart") or (parts[i].className == "Seat") or (parts[i].className == "VehicleSeat") or (parts[i].className == "CornerWedgePart") then
if (prev ~= nil)then
local weld = Instance.new("ManualWeld")
weld.Part0 = prev
weld.Part1 = parts[i]
weld.C0 = prev.CFrame:inverse()
weld.C1 = parts[i].CFrame:inverse()
weld.Parent = prev
end
prev = parts[i]
end
end
Report Abuse
KodakKid3 is not online. KodakKid3
Joined: 25 Dec 2008
Total Posts: 2860
21 Mar 2014 09:39 PM
Thanks, but it didn't work.

Maybe check out the gun itself to see why? it might be something wrong with the gun, not your script.
Report Abuse
KodakKid3 is not online. KodakKid3
Joined: 25 Dec 2008
Total Posts: 2860
21 Mar 2014 10:34 PM
pls help
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
21 Mar 2014 10:38 PM
function weld()
local parts,last = {}
local function scan(parent)
for _,v in pairs(parent:GetChildren()) do
if (v:IsA("BasePart")) then
if (last) then
local w = Instance.new("Weld")
w.Name = ("%s_Weld"):format(v.Name)
w.Part0,w.Part1 = last,v
w.C0 = last.CFrame:inverse()
w.C1 = v.CFrame:inverse()
w.Parent = last
end
last = v
table.insert(parts,v)
end
scan(v)
end
end
scan(script.Parent)
for _,v in pairs(parts) do
v.Anchored = false
end
end

weld()
script:Remove()

^^^not claiming as mine, but it works, just put it in the tool, anchor it, press play, copy it afterwards, reverse, delete previous, post new
-=Robo=-
Report Abuse
KodakKid3 is not online. KodakKid3
Joined: 25 Dec 2008
Total Posts: 2860
21 Mar 2014 11:24 PM
I actually got Ice's to work, thanks both of you.

Now there's just the problem of the gun not going into the player's hand, but stayin gon the ground.

qq
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