Advertisement
Careca_estiloso01

voar de fruta

Oct 11th, 2024
45
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.10 KB | None | 0 0
  1. local flying = false
  2. local speed = 50
  3. local player = game.Players.LocalPlayer
  4. local character = player.Character or player.CharacterAdded:Wait()
  5. local humanoid = character:WaitForChild("Humanoid")
  6. local bodyVelocity = Instance.new("BodyVelocity")
  7. bodyVelocity.MaxForce = Vector3.new(100000, 100000, 100000)
  8.  
  9. local uis = game:GetService("UserInputService")
  10. local rs = game:GetService("RunService")
  11. local guiButton = script.Parent -- Assumindo que o script esteja dentro de um botão de GUI
  12.  
  13. -- Cria um emissor de partículas para o efeito
  14. local particleEmitter = Instance.new("ParticleEmitter")
  15. particleEmitter.Texture = "rbxassetid://YOUR_PARTICLE_ASSET_ID" -- Coloque o ID da textura da partícula aqui
  16. particleEmitter.Rate = 50 -- Quantidade de partículas emitidas por segundo
  17. particleEmitter.Speed = NumberRange.new(5, 10) -- Velocidade das partículas
  18. particleEmitter.Lifetime = NumberRange.new(0.5, 1) -- Tempo de vida das partículas
  19. particleEmitter.Size = NumberSequence.new(0.5, 1) -- Tamanho das partículas
  20. particleEmitter.Color = ColorSequence.new(Color3.fromRGB(255, 0, 0)) -- Cor da partícula (vermelho)
  21.  
  22. -- Função para ativar o voo
  23. local function startFlying()
  24. if not flying then
  25. flying = true
  26. bodyVelocity.Parent = character.HumanoidRootPart
  27. -- Anexa o emissor de partículas ao HumanoidRootPart
  28. particleEmitter.Parent = character.HumanoidRootPart
  29.  
  30. rs.RenderStepped:Connect(function()
  31. if flying then
  32. local moveDirection = Vector3.new(0, 0, 0)
  33.  
  34. if uis.TouchEnabled then
  35. -- Voo via toque na tela (mobile)
  36. local touchPos = uis:GetTouch(1)
  37. if touchPos then
  38. local screenPos = Vector2.new(touchPos.Position.X, touchPos.Position.Y)
  39. local camera = workspace.CurrentCamera
  40. local ray = camera:ScreenPointToRay(screenPos.X, screenPos.Y)
  41. moveDirection = ray.Direction * speed
  42. end
  43. else
  44. -- Voo via mouse (PC)
  45. local mouse = player:GetMouse()
  46. local camera = workspace.CurrentCamera
  47. local ray = camera:ScreenPointToRay(mouse.X, mouse.Y)
  48. moveDirection = ray.Direction * speed
  49. end
  50.  
  51. bodyVelocity.Velocity = moveDirection
  52. end
  53. end)
  54. end
  55. end
  56.  
  57. -- Função para parar o voo
  58. local function stopFlying()
  59. flying = false
  60. bodyVelocity.Parent = nil
  61. -- Remove o emissor de partículas
  62. particleEmitter.Parent = nil
  63. end
  64.  
  65. -- Função para alternar o voo
  66. local function toggleFlying()
  67. if flying then
  68. stopFlying()
  69. else
  70. startFlying()
  71. end
  72. end
  73.  
  74. -- Evento de clique no botão da GUI
  75. guiButton.MouseButton1Click:Connect(toggleFlying)
  76.  
  77. -- Evento de tecla "F" no teclado
  78. uis.InputBegan:Connect(function(input, gameProcessed)
  79. if input.KeyCode == Enum.KeyCode.F and not gameProcessed then
  80. toggleFlying()
  81. end
  82. end)
Advertisement
Comments
  • Careca_estiloso01
    249 days (edited)
    # text 0.31 KB | 0 0
    1. esse script serve ajudar várias pessoas que querem um script de voar mobile porque no youtube só tem desatualizado esse script e pra fruta devilfruit ou DF pra usar pega esse script e cole no local script que tá dentro de uma gui um textbotom ou um imagembotom eu sei eu escrevi errado mais foi se eu ajudei comenta ae
Add Comment
Please, Sign In to add comment
Advertisement