|
| 26 Feb 2012 02:57 PM |
| My script welds my plane using the "Weld" objects. But when it is done welding, the plane removes from the game. I have no clue why it does that? A glitch? |
|
|
| Report Abuse |
|
|
slayer219
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 3445 |
|
|
| 26 Feb 2012 03:19 PM |
| Has nothing to do with the weld object, guarantee it's user error. |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2012 03:24 PM |
while (not script.Parent.Cloned.Value) do wait() end
local parts = {}
function scan(p) for _,v in pairs(p:GetChildren()) do if (v:IsA("BasePart")) then table.insert(parts,v) end scan(v) end end
function weld() scan(script.Parent) local prev for _,v in pairs(parts) do if (prev) then local weld = Instance.new("Weld") weld.Part0 = prev weld.Part1 = v weld.C0 = prev.CFrame:inverse() weld.C1 = v.CFrame:inverse() weld.Parent = prev end prev = v end wait(1) for _,v in pairs(parts) do v.Anchored = false end end
weld() |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 26 Feb 2012 03:26 PM |
This is the function I made to weld objects
function weld(...) local last local parts={...} for index,child in pairs(parts) do if child and child:IsA("BasePart") then if last then local weld=Instance.new("Weld") weld.Part0=last weld.Part1=child weld.C0=last.CFrame:inverse() weld.C1=child.CFrame:inverse() weld.Parent=last end last=child end end end
"Bro five! Wear this to let everyone know you think they deserve a high five." |
|
|
| Report Abuse |
|
|
slayer219
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 3445 |
|
|
| 26 Feb 2012 03:26 PM |
| What are you doing to that poor plane? Welding every part to every part? |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2012 03:27 PM |
| function weld(...) -- What goes in parentheses? |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2012 03:28 PM |
| slayer, how else am I going to make it where the plane doesn't fall apart while flying it? |
|
|
| Report Abuse |
|
|
slayer219
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 3445 |
|
|
| 26 Feb 2012 03:29 PM |
| Weld everything to ONE part. Not everything to eachother. |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2012 03:31 PM |
| So weld everything to the first part the script finds? |
|
|
| Report Abuse |
|
|
slayer219
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 3445 |
|
|
| 26 Feb 2012 03:31 PM |
| Establish one main part, and weld everything else to it. |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2012 03:38 PM |
| I did. Still, the plane just disappears from the game when the parts are unachored after the welding is complete. |
|
|
| Report Abuse |
|
|
slayer219
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 3445 |
|
| |
|
|
| 26 Feb 2012 03:45 PM |
Alright, now it just stopped disappearing! :D but my welding is welding right.
while (not script.Parent.Cloned.Value) do wait() end
local parts = {}
function scan(p) for _,v in pairs(p:GetChildren()) do if (v:IsA("BasePart")) then table.insert(parts,v) end scan(v) end end
function weld() scan(script.Parent) local prev for _,v in pairs(parts) do local weld = Instance.new("Weld") weld.Part0 = prev weld.Part1 = v weld.C0 = script.Parent.Engine.CFrame:inverse() weld.C1 = v.CFrame:inverse() weld.Parent = v prev = v end wait(1) for _,v in pairs(parts) do v.Anchored = false end end
weld() |
|
|
| Report Abuse |
|
|
slayer219
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 3445 |
|
|
| 26 Feb 2012 03:51 PM |
| Sorry, I have to fight a flame war and do this at the same time. Did you go back from using 1 part? |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2012 03:55 PM |
| script.Parent.Engine is the main part that all parts are being CFramed to. |
|
|
| Report Abuse |
|
|
slayer219
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 3445 |
|
|
| 26 Feb 2012 03:56 PM |
You still have:
weld.Part0 = prev
change it to
weld.Part0 = script.Parent.Engine |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2012 04:00 PM |
| Okay, now it's disappearing again. |
|
|
| Report Abuse |
|
|
slayer219
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 3445 |
|
|
| 26 Feb 2012 04:01 PM |
| Oh joy xD well that's how it welds properly... |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2012 04:31 PM |
| Yeah. I think it disappears when the welding is successful lol |
|
|
| Report Abuse |
|
|
slayer219
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 3445 |
|
|
| 26 Feb 2012 04:36 PM |
| Lol... I'm sorry I can't help anymore, stupid ROBLOX glitches. |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 26 Feb 2012 05:58 PM |
That's arg.
function a(...) arg={...} --In legit Lua, you wouldn't need to define arg. print(unpack(arg)) end
a("a","b","c")
"Bro five! Wear this to let everyone know you think they deserve a high five." |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2012 09:24 PM |
| slayer, some parts are CFramed into each other. Would that make it flip everywhere and remove? They are welding with the object. |
|
|
| Report Abuse |
|
|