it only seems to play the fly animations and it dose this https://gyazo.com/5d0ca538ccb754a714717fb104108a68
local uis = game:GetService("UserInputService")
local rs = game:GetService("RunService")
local DigAnimation = Instance.new('Animation')
DigAnimation.AnimationId = "rbxassetid://4332175810"
DAnimation = game.Players.LocalPlayer.Character:WaitForChild("Humanoid", 10):LoadAnimation(DigAnimation)
local button_clicked = false
local myPlayer = game.Players.LocalPlayer
local myMouse = myPlayer:GetMouse()
local myChar = myPlayer.Character
local myHRP = myChar:WaitForChild("HumanoidRootPart")
local camera = myPlayer:GetMouse()
local button = script.Parent
local flying = false
local bp = Instance.new("BodyPosition", myHRP)
bp.MaxForce = Vector3.new()
bp.D = 10
bp.P = 10000
local bg = Instance.new("BodyGyro", myHRP)
bg.MaxTorque = Vector3.new()
bg.D = 10
local Forward = Instance.new("BodyGyro",myHRP)
function fly()
wait()
myPlayer.CameraMinZoomDistance = (5)
myPlayer.CameraMaxZoomDistance = (20)
flying = true
local button_clicked = false
DAnimation:Play()
bp.MaxForce = Vector3.new(10000,10000,10000)
bg.MaxTorque = Vector3.new(10000,10000,10000)
while flying do
wait()
bp.Position = CFrame.new(myHRP.Position, camera.Hit.p)
bg.CFrame = CFrame.new(myHRP.Position, camera.Hit.p)
Forward.Velocity = camera.Hit.lookVector*150
end
end
function endFlying()
wait()
myPlayer.CameraMinZoomDistance = (0.5)
myPlayer.CameraMaxZoomDistance = (40)
local button_clicked = false
DAnimation:Stop()
bp.MaxForce = Vector3.new()
bg.MaxTorque = Vector3.new()
flying = false
end
button.MouseButton1Down:Connect (function()
if not flying then
local button_clicked = false
fly()
else
local button_clicked = false
endFlying()
end
end)
