Advertisement
ProScripter29

UPDATED Fly Script

May 8th, 2023 (edited)
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.79 KB | Gaming | 0 0
  1. local Object = game:GetObjects("rbxassetid://13384504407")[1]
  2.  
  3. Object.Name = "FlyKit"
  4. Object.Parent = game.ReplicatedStorage
  5.  
  6. --[[ Made by coolcapidog
  7. Channel ->> https://www.youtube.com/c/coolcapidog
  8. You can change the settings but you shouldn't change anything except settings.
  9. ]]
  10.  
  11. local KeyCode = Enum.KeyCode.E
  12. local HoverAnimID = "rbxassetid://"
  13. local FlyAnimID = "rbxassetid://"
  14. local WindSoundEnabled = true
  15.  
  16. local BodyVelocity = game.ReplicatedStorage:WaitForChild("FlyKit"):WaitForChild("BodyVelocity"):Clone()
  17. local v3 = game.ReplicatedStorage:WaitForChild("FlyKit"):WaitForChild("BodyGyro"):Clone()
  18. local Character = game.Players.LocalPlayer.Character
  19. local Humanoid = Character:FindFirstChild("Humanoid") or Character:WaitForChild("Humanoid")
  20. BodyVelocity.Parent = Character
  21. v3.Parent = Character
  22. local Hover = Instance.new("Animation")
  23. Hover.AnimationId = HoverAnimID
  24. local Fly = Instance.new("Animation")
  25. Fly.AnimationId = FlyAnimID
  26. local Sound1 = Instance.new("Sound", Character.HumanoidRootPart)
  27. Sound1.SoundId = "rbxassetid://3308152153"
  28. Sound1.Name = "Sound1"
  29. if WindSoundEnabled == false then
  30.     Sound1.Volume = 0
  31. end
  32. Sound1.Volume = 1
  33. local v10 = Humanoid.Animator:LoadAnimation(Hover)
  34. local v11 = Humanoid.Animator:LoadAnimation(Fly)
  35. local Camera = game.Workspace.Camera
  36. local function u2()
  37.     if Humanoid.MoveDirection == Vector3.new(0, 0, 0) then
  38.         return Humanoid.MoveDirection
  39.     end
  40.     local v12 = (Camera.CFrame * CFrame.new((CFrame.new(Camera.CFrame.p, Camera.CFrame.p + Vector3.new(Camera.CFrame.lookVector.x, 0, Camera.CFrame.lookVector.z)):VectorToObjectSpace(Humanoid.MoveDirection)))).p - Camera.CFrame.p;
  41.     if v12 == Vector3.new() then
  42.         return v12
  43.     end
  44.     return v12.unit
  45. end
  46. local Flymoving = game.ReplicatedStorage:WaitForChild("FlyKit"):WaitForChild("Flymoving")
  47. local TweenService = game:GetService("TweenService")
  48. local UIS = game:GetService("UserInputService")
  49. local Flying = false
  50.  
  51. game:GetService("RunService").RenderStepped:Connect(function()
  52.     if Character then
  53.         if Flying == true then
  54.             Humanoid:ChangeState(6)
  55.             v3.CFrame = game.Workspace.Camera.CFrame
  56.             if u2() == Vector3.new(0, 0, 0) then
  57.                 Flymoving.Value = false
  58.             else
  59.                 Flymoving.Value = true
  60.             end
  61.             TweenService:Create(BodyVelocity, TweenInfo.new(0.3), {Velocity = u2() * 135}):Play()
  62.         end
  63.        
  64.     end
  65. end)
  66.  
  67. Flymoving.Changed:Connect(function(p1)
  68.     if p1 == true then
  69.         TweenService:Create(Camera, TweenInfo.new(0.5), {FieldOfView = 80}):Play()
  70.         v10:Stop()
  71.         Sound1:Play()
  72.         v11:Play()
  73.         return
  74.     end
  75.     if p1 == false then
  76.         TweenService:Create(Camera, TweenInfo.new(0.5), {FieldOfView = 70}):Play()
  77.         v11:Stop()
  78.         Sound1:Stop()
  79.         v10:Play()
  80.     end
  81. end)
  82.  
  83. local xractivated = false
  84.  
  85. UIS.JumpRequest:Connect(function()
  86.     if Flying == false then
  87.         Flying = true
  88.         if Character:FindFirstChild("HumanoidRootPart") then
  89.             v10:Play(0.1, 1, 1)
  90.             Humanoid:SetStateEnabled(Enum.HumanoidStateType.Running, false)
  91.             Humanoid:SetStateEnabled(Enum.HumanoidStateType.Climbing, false)
  92.             Humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
  93.             Humanoid:SetStateEnabled(Enum.HumanoidStateType.Freefall, false)
  94.             Character.HumanoidRootPart.Running.Volume = 0
  95.             Humanoid:ChangeState(6)
  96.             BodyVelocity.Parent = Character.HumanoidRootPart
  97.             v3.Parent = Character.HumanoidRootPart
  98.         end
  99.     else
  100.         Flying = false
  101.         Flymoving.Value = false
  102.         Humanoid:SetStateEnabled(Enum.HumanoidStateType.Running, true)
  103.         Humanoid:SetStateEnabled(Enum.HumanoidStateType.Climbing, true)
  104.         Humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, true)
  105.         Humanoid:SetStateEnabled(Enum.HumanoidStateType.Freefall, true)
  106.         Character.HumanoidRootPart.Running.Volume = 0.65
  107.         Humanoid:ChangeState(8)
  108.         BodyVelocity.Parent = Character
  109.         v3.Parent = Character
  110.         v10:Stop()
  111.         v11:Stop()
  112.     end
  113. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement