|
| 25 Jun 2013 11:15 PM |
| Hi everyone. I'm working on a gun tool atm. I have my gun ready, I can put it into a tool perfectly fine, I have a weld script inside of the handle and I can actually pick up the gun perfectly fine, no issues. However, when I un-equip and then re-equip the gun, it all falls apart. Is there something I'm missing here? I don't quite see why it works fine, and then just breaks the second I re-equip it? Any help would be awesome, ty :3. |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2013 11:17 PM |
You need the weld script to weld it everytime you equip it.
tool.Equipped:connect(function() --weld stuff end) |
|
|
| Report Abuse |
|
|
babyyip
|
  |
| Joined: 17 Mar 2012 |
| Total Posts: 4927 |
|
|
| 25 Jun 2013 11:18 PM |
@Sam Yet you don't give me the right script for a back flip script |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2013 11:20 PM |
| @babyyip - That requires way more than this does. There is not built in function, that I know of, that will make a player do a backflip. |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2013 11:25 PM |
It seems to weld, but the pieces fall apart before they weld, so they just end up floating. My full script is as follows:
--------------------------------------------------------
MainPart = script.Parent t = script.Parent.Parent
function stick(x, y) weld = Instance.new("Weld") weld.Part0 = x weld.Part1 = y local HitPos = x.Position local CJ = CFrame.new(HitPos) local C0 = x.CFrame:inverse() *CJ local C1 = y.CFrame:inverse() * CJ weld.C0 = C0 weld.C1 = C1 weld.Parent = y end
function Weldnow() c = t:children() for n = 1, #c do if (c[n].className == "Part") then if (c[n].Name ~= MainPart.Name) then stick(c[n], MainPart) wait() c[n].Anchored = false end end
if (c[n].className == "Flag") then if (c[n].Name ~= MainPart.Name) then stick(c[n], MainPart) wait() c[n].Anchored = false end end
if (c[n].className == "Handle") then if (c[n].Name ~= MainPart.Name) then stick(c[n], MainPart) wait() c[n].Anchored = false end end
if (c[n].className == "Hat") then if (c[n].Name ~= MainPart.Name) then stick(c[n], MainPart) wait() c[n].Anchored = false end end
if (c[n].className == "Seat") then if (c[n].Name ~= MainPart.Name) then stick(c[n], MainPart) wait() c[n].Anchored = false end end if (c[n].className == "SpawnLocation") then if (c[n].Name ~= MainPart.Name) then stick(c[n], MainPart) wait() c[n].Anchored = false end end if (c[n].className == "TrussPart") then if (c[n].Name ~= MainPart.Name) then stick(c[n], MainPart) wait() c[n].Anchored = false end end if (c[n].className == "VehicleSeat") then if (c[n].Name ~= MainPart.Name) then stick(c[n], MainPart) wait() c[n].Anchored = false end end end end
wait()
script.Parent.Anchored = false
Weldnow() t.Equipped:connect(Weldnow)
---------------------------------------------------------------------------------
|
|
|
| Report Abuse |
|
|
|
| 25 Jun 2013 11:31 PM |
| Ah, I think I was just using a rubbish tool weld, and the series of welds/unwelds was all out of order. Thanks for your help :3. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|