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 » Scripters
Home Search
 

Weld Arm script causes crash on respawn. Help?

Previous Thread :: Next Thread 
222304 is not online. 222304
Top 100 Poster
Joined: 26 May 2008
Total Posts: 24900
12 Feb 2016 04:50 PM
I've been using two arm scripts to weld the player's arm to a position while allowing vertical movement. Problem is, if a player dies/resets while this script is active, they will crash on respawn. I can't seem to diagnose the problem, so I'm turning to you.



local Tool

local arm = nil
local torso = nil
local weld33 = nil -- right arm
local welds = {}

function VectoDeg(origpoint,point1,point2)
local torsocframeR = torso.CFrame*CFrame.Angles(0,1.57,0)
local lookL = torsocframeR.lookVector
local look = torso.CFrame.lookVector
local dir = (point2-point1).unit
local y = dir.Y
local distout = math.sqrt(dir.X*dir.X+dir.Z*dir.Z)
if (((origpoint+dir*5)-(origpoint+look*5)).magnitude > ((origpoint+dir*5)-(origpoint+lookL*5)).magnitude) or
(((origpoint+dir*5)-(origpoint+lookL*-5)).magnitude > ((origpoint+dir*5)-(origpoint+look*-5)).magnitude) or
((((origpoint+dir*5)-(origpoint+look*5)).magnitude > ((origpoint+dir*5)-(origpoint+lookL*5)).magnitude) and
(((origpoint+dir*5)-(origpoint+lookL*-5)).magnitude > ((origpoint+dir*5)-(origpoint+look*-5)).magnitude)) then
if (((origpoint+dir*5)-(origpoint+lookL*5)).magnitude < ((origpoint+dir*5)-(origpoint+look*-5)).magnitude) then
local bla = distout/math.sqrt(2)
dir = (torso.Position-(torso.CFrame*CFrame.new(bla,-y,bla)).p).unit
else
local bla = distout/math.sqrt(2)
dir = (torso.Position-(torso.CFrame*CFrame.new(-bla,-y,-bla)).p).unit
end
end
local newpoint = origpoint+dir*.5
local cframe = CFrame.new(newpoint,newpoint-dir)
cframe = cframe*CFrame.Angles(-1.57,3.14,-.65)
weld33.C1 = cframe:inverse()
weld33.C0 = torso.CFrame:inverse()
end

function Equip(mouse)
Tool = script.Parent
wait(0.001)
arm = Tool.Parent:FindFirstChild("Right Arm")
torso = Tool.Parent:FindFirstChild("Torso")
if arm ~= nil and torso ~= nil then
local sh = torso:FindFirstChild("Right Shoulder")
if sh ~= nil then
local yes = true
if yes then
yes = false
sh.Part1 = nil
local weld1 = Instance.new("Weld") -- right arm
weld33 = weld1
weld1.Part0 = torso
weld1.Parent = torso
weld1.Part1 = arm
weld1.C1 = CFrame.new(-0.75, -0.4, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
welds[1] = weld1
while true do
wait(.01)
VectoDeg((torso.CFrame*CFrame.new(1,.5,-.5)).p,(torso.CFrame*CFrame.new(1,.5,-.5)).p,script.Parent.Parent.Humanoid.TargetPoint)
end
end
else
print("sh")
end
else
print("arms")
end
end

function Unequip(mouse)
if arm ~= nil and torso ~= nil then
local sh = torso:FindFirstChild("Right Shoulder")
if sh ~= nil then
local yes = true
if yes then
yes = false
sh.Part1 = arm
welds[1].Parent = nil
end
else
print("sh")
end
else
print("arms")
end
if script.Parent:findFirstChild("RandWeight") == nil then
script.Parent:remove()
end
end

script.AncestryChanged:connect(function()
if script:findFirstChild("secure") == nil then
if script.Parent.className == "Tool" then
script.Parent.Unequipped:connect(Unequip)
script.Parent.Equipped:connect(Equip)
script.Parent.ChildRemoved:connect(Unequip)
local new = Instance.new("NumberValue")
new.Name = "secure"
new.Parent = script
end
end
end)
Report Abuse
222304 is not online. 222304
Top 100 Poster
Joined: 26 May 2008
Total Posts: 24900
12 Feb 2016 04:57 PM
b1
Report Abuse
badguy1233 is not online. badguy1233
Joined: 23 Jul 2009
Total Posts: 885
12 Feb 2016 04:59 PM
geez, this is a behemoth
try using prints to find out exactly where it does wrong
Report Abuse
222304 is not online. 222304
Top 100 Poster
Joined: 26 May 2008
Total Posts: 24900
12 Feb 2016 05:47 PM
Yea, problem is it works just fine in solo with no anomalies
Report Abuse
222304 is not online. 222304
Top 100 Poster
Joined: 26 May 2008
Total Posts: 24900
12 Feb 2016 06:41 PM
:(
Report Abuse
222304 is not online. 222304
Top 100 Poster
Joined: 26 May 2008
Total Posts: 24900
12 Feb 2016 11:48 PM
b2
Report Abuse
222304 is not online. 222304
Top 100 Poster
Joined: 26 May 2008
Total Posts: 24900
13 Feb 2016 09:14 AM
b3
Report Abuse
222304 is not online. 222304
Top 100 Poster
Joined: 26 May 2008
Total Posts: 24900
13 Feb 2016 09:39 AM
b4
Report Abuse
222304 is not online. 222304
Top 100 Poster
Joined: 26 May 2008
Total Posts: 24900
13 Feb 2016 10:18 AM
b5
Report Abuse
TheGreenDeveloper is not online. TheGreenDeveloper
Joined: 29 Dec 2013
Total Posts: 776
13 Feb 2016 10:19 AM
The free models and bumps are making me not want to help you.
Report Abuse
222304 is not online. 222304
Top 100 Poster
Joined: 26 May 2008
Total Posts: 24900
13 Feb 2016 10:20 AM
"The free models and bumps are making me not want to help you."

thanks for the reply!
Report Abuse
222304 is not online. 222304
Top 100 Poster
Joined: 26 May 2008
Total Posts: 24900
13 Feb 2016 10:47 AM
we need more friendly replies like that
Report Abuse
222304 is not online. 222304
Top 100 Poster
Joined: 26 May 2008
Total Posts: 24900
13 Feb 2016 07:14 PM
my friends
Report Abuse
222304 is not online. 222304
Top 100 Poster
Joined: 26 May 2008
Total Posts: 24900
13 Feb 2016 08:43 PM
my amigos
Report Abuse
222304 is not online. 222304
Top 100 Poster
Joined: 26 May 2008
Total Posts: 24900
13 Feb 2016 09:13 PM
my comrades
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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