Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local flying = false
- local speed = 50
- local player = game.Players.LocalPlayer
- local character = player.Character or player.CharacterAdded:Wait()
- local humanoid = character:WaitForChild("Humanoid")
- local bodyVelocity = Instance.new("BodyVelocity")
- bodyVelocity.MaxForce = Vector3.new(100000, 100000, 100000)
- local uis = game:GetService("UserInputService")
- local rs = game:GetService("RunService")
- local guiButton = script.Parent -- Assumindo que o script esteja dentro de um botão de GUI
- -- Cria um emissor de partículas para o efeito
- local particleEmitter = Instance.new("ParticleEmitter")
- particleEmitter.Texture = "rbxassetid://YOUR_PARTICLE_ASSET_ID" -- Coloque o ID da textura da partícula aqui
- particleEmitter.Rate = 50 -- Quantidade de partículas emitidas por segundo
- particleEmitter.Speed = NumberRange.new(5, 10) -- Velocidade das partículas
- particleEmitter.Lifetime = NumberRange.new(0.5, 1) -- Tempo de vida das partículas
- particleEmitter.Size = NumberSequence.new(0.5, 1) -- Tamanho das partículas
- particleEmitter.Color = ColorSequence.new(Color3.fromRGB(255, 0, 0)) -- Cor da partícula (vermelho)
- -- Função para ativar o voo
- local function startFlying()
- if not flying then
- flying = true
- bodyVelocity.Parent = character.HumanoidRootPart
- -- Anexa o emissor de partículas ao HumanoidRootPart
- particleEmitter.Parent = character.HumanoidRootPart
- rs.RenderStepped:Connect(function()
- if flying then
- local moveDirection = Vector3.new(0, 0, 0)
- if uis.TouchEnabled then
- -- Voo via toque na tela (mobile)
- local touchPos = uis:GetTouch(1)
- if touchPos then
- local screenPos = Vector2.new(touchPos.Position.X, touchPos.Position.Y)
- local camera = workspace.CurrentCamera
- local ray = camera:ScreenPointToRay(screenPos.X, screenPos.Y)
- moveDirection = ray.Direction * speed
- end
- else
- -- Voo via mouse (PC)
- local mouse = player:GetMouse()
- local camera = workspace.CurrentCamera
- local ray = camera:ScreenPointToRay(mouse.X, mouse.Y)
- moveDirection = ray.Direction * speed
- end
- bodyVelocity.Velocity = moveDirection
- end
- end)
- end
- end
- -- Função para parar o voo
- local function stopFlying()
- flying = false
- bodyVelocity.Parent = nil
- -- Remove o emissor de partículas
- particleEmitter.Parent = nil
- end
- -- Função para alternar o voo
- local function toggleFlying()
- if flying then
- stopFlying()
- else
- startFlying()
- end
- end
- -- Evento de clique no botão da GUI
- guiButton.MouseButton1Click:Connect(toggleFlying)
- -- Evento de tecla "F" no teclado
- uis.InputBegan:Connect(function(input, gameProcessed)
- if input.KeyCode == Enum.KeyCode.F and not gameProcessed then
- toggleFlying()
- end
- end)
Advertisement
Comments
-
- 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