SN0X
|
  |
| Joined: 24 Oct 2011 |
| Total Posts: 7277 |
|
|
| 28 Jan 2012 04:18 AM |
I use this script for all sorts of tools, and it's really starting to bug me now...I've tryed loads of things to stop it...when I equip a tool while walking or jumping, sometimes it's as if there was a delay and the tool gets welded but a few studs behind the player's arm. Sometimes the tool just turns into one brick; the handle. I've tryed anchoring it before welding, adding an extra weld before the welding when equipped and unequipped, I've gotten rid of all waits, yet it still troubles me...
local H = script.Parent:GetChildren() for i = 1, #H do local P0 = script.Parent.Handle local P = H[i] if P.ClassName == "Part" then local W = Instance.new("Weld") W.Part0 = P0 W.Part1 = P W.C0 = P0.CFrame:inverse() W.C1 = P.CFrame:inverse() W.Parent = script.Parent W.Name = "UEWeld" end end
local Can = true function oe(m) if Can == false then return end Can = false local H = script.Parent:GetChildren() for i = 1, #H do local P0 = script.Parent.Handle local P = H[i] if P.Name ~= "Bullet" then if P.ClassName == "Part" then local W = Instance.new("Weld") W.Part0 = P0 W.Part1 = P W.C0 = P0.CFrame:inverse() W.C1 = P.CFrame:inverse() W.Parent = script.Parent W.Name = "EWeld" end
local H = script.Parent:GetChildren() for i = 1, #H do if P.ClassName == "Weld" and P.Name == "UEWeld" then P:Destroy() end if P.ClassName == "Part" then P.Anchored = false end end
Can = true end end end script.Parent.Equipped:connect(oe)
function oe() if Can == false then return end Can = false local H = script.Parent:GetChildren() for i = 1, #H do local P0 = script.Parent.Handle local P = H[i] if P.Name ~= "Bullet" then if P.ClassName == "Part" then local W = Instance.new("Weld") W.Part0 = P0 W.Part1 = P W.C0 = P0.CFrame:inverse() W.C1 = P.CFrame:inverse() W.Parent = script.Parent W.Name = "UEWeld" end
for i = 1, #H do if P.ClassName == "Weld" and P.Name == "EWeld" then P:Destroy() end if P.ClassName == "Part" then P.Anchored = true end end
Can = true end end end script.Parent.Unequipped:connect(oe)
Please help, I own a clan, I'm making a base, and I am also making a war game, so I don't see how I will be able to use this. If you want to test just get any old tool and remove the welding script and add this, as long as the tool has more than 1 part. |
|
|
| Report Abuse |
|
|
| |
|
SN0X
|
  |
| Joined: 24 Oct 2011 |
| Total Posts: 7277 |
|
|
| 28 Jan 2012 10:29 AM |
...
No output, I never said it didn't work, I said there was a delay. Hmm...is it just because my script is innefficient? |
|
|
| Report Abuse |
|
|
|
| 28 Jan 2012 10:33 AM |
CFrame values.
Fill in the values in studio/edit.
Let the weld script load the values on the Welds. |
|
|
| Report Abuse |
|
|
|
| 28 Jan 2012 10:36 AM |
| reason it does that is because there is a split second where the weapon is in workspace before the weld script welds them. to fix it you either have to tell the future of when the tool is going to be in the workspace, or make peices always go back to thier normal position |
|
|
| Report Abuse |
|
|
SN0X
|
  |
| Joined: 24 Oct 2011 |
| Total Posts: 7277 |
|
|
| 29 Jan 2012 03:58 AM |
@Grand,
I know that, but read the script, it's anchored and already welded before it gets the new weld. It gets the new weld first, then the old weld gets deleted and the weapon gets un-anchored, so it shouldn't go wrong, but apperently, it does.
@2 above, wot? |
|
|
| Report Abuse |
|
|
| |
|
SN0X
|
  |
| Joined: 24 Oct 2011 |
| Total Posts: 7277 |
|
|
| 05 Feb 2012 08:14 AM |
It seems that when I try to make the gun break, to test, it won't, but when I am just playing around with friends, battling, it breaks. Makes it hard for me to test diffferent things.
|
|
|
| Report Abuse |
|
|
SN0X
|
  |
| Joined: 24 Oct 2011 |
| Total Posts: 7277 |
|
|
| 05 Feb 2012 03:17 PM |
I know why. Roblox changes the handle's pos when equipped, right? That's why it doesn't weld with the handle part in the right place. Maybe, if I re-write this, I can make it more efficient and quicker, and so weld before the handle's position is changed.
|
|
|
| Report Abuse |
|
|
SN0X
|
  |
| Joined: 24 Oct 2011 |
| Total Posts: 7277 |
|
|
| 06 Feb 2012 01:50 AM |
Yep it's really inefficient, but the thing is, even if I make it as quick as possible, it would sometimes still weld with the handle in a different place when there's alot of lagg, right?
Also do I actually need to keep the previous weld, anchor it, etc.? Or does it just have to weld when equipped and unequipped?
My guns have lots of problems. I am considering re-scripting them all. It would just take a while, since I have animations, clips, recoils, ammo, cursor changes, small gun animations and more.
Lol looking at scripts I wrote ages ago is funny xD |
|
|
| Report Abuse |
|
|
| |
|