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 delay

Previous Thread :: Next Thread 
SN0X is not online. 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
FreeGamesROBLOX is not online. FreeGamesROBLOX
Joined: 15 Jun 2011
Total Posts: 6622
28 Jan 2012 09:05 AM
Output
Now
Report Abuse
SN0X is not online. 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
buildthomas is not online. buildthomas
Joined: 05 Dec 2008
Total Posts: 715
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
GrandAwsome is not online. GrandAwsome
Joined: 12 Jul 2011
Total Posts: 326
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 is not online. 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
LuisPambid is not online. LuisPambid
Joined: 31 Mar 2011
Total Posts: 532
29 Jan 2012 04:33 AM
...
Report Abuse
SN0X is not online. 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 is not online. 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 is not online. 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
LuisPambid is not online. LuisPambid
Joined: 31 Mar 2011
Total Posts: 532
06 Feb 2012 03:13 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