? about a fly again just with particles
Okay, so i know that this kills me cause of the ClearAllChildren part in the Torso but i don't know what to do to change that any help there is appreciated. Secondly ... how do i make it so i can use my own particle and not the default star shape. Because i don't want the star while I'm flying
so if you know how to make the particle use my own decal that would be appreciated
thank you,
~Fin
function Fly()
01 | if Flying and Player and Torso and Humanoid and Humanoid.Health > 0 then |
03 | local Momentum = Vector 3. new( 0 , 0 , 0 ) |
04 | local LastMomentum = Vector 3. new( 0 , 0 , 0 ) |
06 | local CurrentSpeed = Speed.MaxSpeed |
07 | local Inertia = ( 1 - (Speed.CurrentSpeed / CurrentSpeed)) |
08 | fire = Instance.new( "ParticleEmitter" ) |
09 | fire.Parent = script.Parent.Parent [ "Left Leg" ] |
10 | fire 2 = Instance.new( "ParticleEmitter" ) |
11 | fire 2. Parent = script.Parent.Parent [ "Right Leg" ] |
12 | fire 3 = Instance.new( "ParticleEmitter" ) |
13 | fire 3. Parent = script.Parent.Parent [ "Left Arm" ] |
14 | fire 4 = Instance.new( "ParticleEmitter" ) |
15 | fire 4. Parent = script.Parent.Parent [ "Right Arm" ] |
16 | fire 5 = Instance.new( "ParticleEmitter" ) |
17 | fire 5. Parent = script.Parent.Parent.Torso |
18 | fire 6 = Instance.new( "ParticleEmitter" ) |
19 | fire 6. Parent = script.Parent.Parent.Head |
20 | BodyVelocity.maxForce = Vector 3. new( 1 , 1 , 1 ) * ( 10 ^ 6 ) |
22 | BodyGyro.maxTorque = Vector 3. new(BodyGyro.P, BodyGyro.P, BodyGyro.P) |
23 | BodyGyro.cframe = Torso.CFrame |
25 | while Flying and Torso and Humanoid and Humanoid.Health > 0 do |
27 | if CurrentSpeed ~ = Speed.MaxSpeed then |
28 | CurrentSpeed = Speed.MaxSpeed |
29 | Inertia = ( 1 - (Speed.CurrentSpeed / CurrentSpeed)) |
32 | local Direction = CurrentCamera.CoordinateFrame:vectorToWorldSpace(Vector 3. new(Controls.Left.Number + Controls.Right.Number, math.abs(Controls.Forward.Number) * 0.2 , Controls.Forward.Number + Controls.Backward.Number)) |
33 | local Movement = Direction * Speed.CurrentSpeed |
35 | Momentum = (Momentum * Inertia) + Movement |
37 | local TotalMomentum = Momentum.magnitude |
39 | if TotalMomentum > CurrentSpeed then |
40 | TotalMomentum = CurrentSpeed |
43 | local Tilt = ((Momentum * Vector 3. new( 1 , 0 , 1 )).unit:Cross(((LastMomentum * Vector 3. new( 1 , 0 , 1 )).unit))).y |
44 | local StringTilt = tostring (Tilt) |
46 | if StringTilt = = "-1.#IND" or StringTilt = = "1.#IND" or Tilt = = math.huge or Tilt = = - math.huge or StringTilt = = tostring ( 0 / 0 ) then |
50 | local AbsoluteTilt = math.abs(Tilt) |
52 | if AbsoluteTilt > 0.06 or AbsoluteTilt < 0.0001 then |
53 | if math.abs(LastTilt) > 0.0001 then |
54 | Tilt = (LastTilt * 0.9 ) |
59 | Tilt = ((LastTilt * 0.77 ) + (Tilt * 0.25 )) |
64 | if TotalMomentum < 0.5 then |
65 | Momentum = Vector 3. new( 0 , 0 , 0 ) |
67 | BodyGyro.cframe = CurrentCamera.CoordinateFrame |
69 | BodyGyro.cframe = CFrame.new(Vector 3. new( 0 , 0 , 0 ), Momentum) * CFrame.Angles( 0 , 0 , (Tilt * - 20 )) * CFrame.Angles((math.pi * - 0.5 * (TotalMomentum / CurrentSpeed)), 0 , 0 ) |
72 | BodyVelocity.velocity = Momentum |
73 | LastMomentum = Momentum |
78 | BodyVelocity.maxForce = Vector 3. new( 0 , 0 , 0 ) |
79 | BodyPosition.maxForce = Vector 3. new( 0 , 0 , 0 ) |
80 | BodyGyro.maxTorque = Vector 3. new( 0 , 0 , 0 ) |
end
function StopFlying()
Flying = false
BodyVelocity.maxForce = Vector3.new(0, 0, 0)
BodyPosition.maxForce = Vector3.new(0, 0, 0)
BodyGyro.maxTorque = Vector3.new(0, 0, 0)
script.Parent.Parent["Left Leg"]:ClearAllChildren()
script.Parent.Parent["Right Leg"]:ClearAllChildren()
script.Parent.Parent["Left Arm"]:ClearAllChildren()
script.Parent.Parent["Right Arm"]:ClearAllChildren()
script.Parent.Parent.Torso:ClearAllChildren()
script.Parent.Parent.Head:ClearAllChildren()
end