of     2   
chevron_rightchevron_rightchevron_right

222304
Top 100 Poster
#183398539Thursday, February 11, 2016 11:26 PM GMT

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)
222304
Top 100 Poster
#183398632Thursday, February 11, 2016 11:28 PM GMT

This thread is the actual continuation of my previous thread (http://forum.roblox.com/Forum/ShowPost.aspx?PostID=183394566) This is the actual issue, not the camera script.
222304
Top 100 Poster
#183400031Thursday, February 11, 2016 11:51 PM GMT

I can't see why it would break the game when dying, though.
222304
Top 100 Poster
#183400971Friday, February 12, 2016 12:08 AM GMT

the only issue I can think of is that when the script is first applied to the player it would cause issues on respawn
TimeTicks
#183402099Friday, February 12, 2016 12:26 AM GMT

while wait() do
222304
Top 100 Poster
#183403060Friday, February 12, 2016 12:42 AM GMT

no dice :(
222304
Top 100 Poster
#183403717Friday, February 12, 2016 12:52 AM GMT

i'm stumped
TimeTicks
#183403913Friday, February 12, 2016 12:55 AM GMT

when they respawn something is looping too much. Maybe its the cframe
222304
Top 100 Poster
#183404167Friday, February 12, 2016 12:59 AM GMT

Yeah, the problem is that it works fine in Solo. Online is where the trouble starts
222304
Top 100 Poster
#183404649Friday, February 12, 2016 1:07 AM GMT

Help pls
222304
Top 100 Poster
#183407556Friday, February 12, 2016 1:45 AM GMT

I will drag this thread up to the top if it means getting a fix
222304
Top 100 Poster
#183409093Friday, February 12, 2016 2:08 AM GMT

If it helps, this local script is in a tool (which you can probably guess by line 1)
SwagCuzYolo
#183411138Friday, February 12, 2016 2:44 AM GMT

MY EYES
222304
Top 100 Poster
#183411154Friday, February 12, 2016 2:44 AM GMT

dang man
222304
Top 100 Poster
#183411963Friday, February 12, 2016 2:58 AM GMT

I swear it has to do with the "RandWeight" value in the weapon. I can't think of anything else
222304
Top 100 Poster
#183412607Friday, February 12, 2016 3:09 AM GMT

This is a bit out of my scope for troubleshooting. It works flawlessly in Solo so I can't step into the code.
222304
Top 100 Poster
#183416250Friday, February 12, 2016 4:14 AM GMT

Revive
222304
Top 100 Poster
#183417919Friday, February 12, 2016 4:52 AM GMT

I refuse to let you die
SwagCuzYolo
#183418063Friday, February 12, 2016 4:55 AM GMT

KILL THE MONSTROSITY BEFORE IT REPRODUCES
222304
Top 100 Poster
#183418156Friday, February 12, 2016 4:57 AM GMT

We can do that after we find a resolution :(
SwagCuzYolo
#183418375Friday, February 12, 2016 5:03 AM GMT

if script.Parent:findFirstChild("RandWeight") == nil then script.Parent:remove() end end :remove() keeps whatever you killed in memory so use :Destroy() 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) this is probably infinitely looping somehow
222304
Top 100 Poster
#183418822Friday, February 12, 2016 5:14 AM GMT

yeah, stepping into the code in solo didn't prove anything useful
222304
Top 100 Poster
#183432223Friday, February 12, 2016 3:31 PM GMT

:(
222304
Top 100 Poster
#183432814Friday, February 12, 2016 3:49 PM GMT

honestly, swagcuzyolo is probably on to something. I just can't diagnose exactly what's throwing an exception if any
222304
Top 100 Poster
#183440551Friday, February 12, 2016 6:36 PM GMT

man

    of     2   
chevron_rightchevron_rightchevron_right