Saber throw can't figure out what the problem is? [closed]
So I have a problem im a star wars developer and my players have been asking me to add saber throw to the lightsabers here's a part of it .. Did I forgot something ?
02 | if throwing = = true and enabled then |
04 | local saber = character:findFirstChild(ls) |
05 | local throwingHandle = saber:Clone() |
06 | DebrisService:AddItem(throwingHandle, 5 ) |
07 | throwingHandle.Parent = game.Workspace |
08 | for _, child in ipairs (throwingHandle:GetChildren( "ManualWeld" and "EmitterWeld" and "SaberWeld" )) do |
12 | throwingHandle.Handle.Velocity = (mouse.TargetPoint - saber.Handle.CFrame.p).unit * 100 |
13 | saber.Handle.SaberWeld.C 0 = CFrame.new(saber.Handle.CFrame.p, saber.Handle.CFrame.p + saber.Handle.Velocity) * CFrame.Angles( 0 , 0 , math.rad(- 90 )) |
14 | local floatingForce = Instance.new( 'BodyForce' , saber.Handle) |
15 | floatingForce.force = Vector 3. new( 0 , 196.2 * saber.Handle:GetMass() * 0.98 , 0 ) |
16 | local spin = Instance.new( 'BodyAngularVelocity' , saber.Handle) |
17 | spin.angularvelocity = saber.Handle.CFrame:vectorToWorldSpace(Vector 3. new( 0 , - 400 , 0 )) |
21 | local touchedConn = saber.Handle.Touched:connect( function (hit) |
22 | saber.Handle.Velocity = (mouse.TargetPoint + saber.Handle.CFrame.p).unit * 100 |
23 | saber.Handle.SaberWeld.C 0 = CFrame.new(saber.Handle.CFrame.p, saber.Handle.CFrame.p + saber.Handle.Velocity) * CFrame.Angles( 0 , 0 , math.rad(- 90 )) |
24 | local floatingForce = Instance.new( 'BodyForce' , saber.Handle) |
25 | floatingForce.force = Vector 3. new( 0 , 196.2 * saber.Handle:GetMass() * 0.98 , 0 ) |
26 | local spin = Instance.new( 'BodyAngularVelocity' , saber.Handle) |
27 | spin.angularvelocity = saber.Handle.CFrame:vectorToWorldSpace(Vector 3. new( 0 , - 400 , 0 )) |
31 | if saber.Handle and throwing then |
32 | WeldParts(character [ "Right Arm" ] ) |
33 | saber.Handle.SaberWeld.C 0 = CFrame.new( 0 ,- 1 , 0 ) * CFrame.fromEulerAnglesXYZ(math.rad( 90 ),math.rad( 180 ),math.rad( 180 )) |
34 | saber.Parent = character |