this is the script i would like to know how i would add custom animation to it
repeat wait() until script.WhitelistModule
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")
local hrp = char:WaitForChild("HumanoidRootPart")
local controlModule = require(player:WaitForChild("PlayerScripts"):WaitForChild("PlayerModule"):WaitForChild("ControlModule"))
local UIS = game:GetService("UserInputService")
local cam = workspace.CurrentCamera
local bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.MaxForce = Vector3.new(1, 1, 1) * 10^6
bodyVelocity.P = 10^6
local bodyGyro = Instance.new("BodyGyro")
bodyGyro.MaxTorque = Vector3.new(1, 1, 1) * 10^6
bodyGyro.P = 10^6
local flying = false
local WhitelistModule = require(script.WhitelistModule)
local function toggleFlyingQ()
if not WhitelistModule.IsPlayerWhitelisted(player) then
return -- Player is not whitelisted, exit the function
end
flying = not flying
bodyGyro.Parent = flying and hrp or nil
bodyVelocity.Parent = flying and hrp or nil
bodyGyro.CFrame = hrp.CFrame
bodyVelocity.Velocity = Vector3.new()
char.Animate.Disabled = flying
if flying then
while flying do
local movevector = controlModule:GetMoveVector()
local direction = cam.CFrame.RightVector * (movevector.X) + cam.CFrame.LookVector * (movevector.Z * -1)
if direction:Dot(direction) > 0 then
direction = direction.Unit
end
bodyGyro.CFrame = cam.CFrame
bodyVelocity.Velocity = direction * 100
if humanoid.MoveDirection ~= Vector3.new() then
-- animations
end
wait()
end
end
end
UIS.InputBegan:Connect(function(input, processed)
if not processed and input.KeyCode == Enum.KeyCode.Q then
toggleFlyingQ()
end
end)
local jumpButton
if UIS.TouchEnabled then
pcall(function()
jumpButton = player:WaitForChild("PlayerGui"):WaitForChild("TouchGui"):WaitForChild("TouchControlFrame"):WaitForChild("JumpButton")
end)
end
if jumpButton ~= nil then
jumpButton.MouseButton1Down:Connect(toggleFlyingQ)
end
this is not my fly script its from a tutorial