Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --https://youtu.be/Ut8uWXHiucU
- local UserInputService = game:GetService("UserInputService")
- local player = game.Players.LocalPlayer
- local mouse = player:GetMouse()
- local keyHeld = false
- function KeyDown(input, gameProcessed)
- if input.KeyCode == Enum.KeyCode.E then
- keyHeld = true
- while keyHeld do
- -- Create an explosion at the mouse's position
- local explosion = Instance.new("Explosion", game.Workspace)
- explosion.Position = Vector3.new(mouse.Hit.p.X, mouse.Hit.p.Y, mouse.Hit.p.Z)
- -- Wait a short time before creating the next explosion
- wait(0.5) -- Adjust the time for explosion frequency as needed
- end
- end
- end
- function KeyUp(input, gameProcessed)
- if input.KeyCode == Enum.KeyCode.E then
- keyHeld = false
- end
- end
- UserInputService.InputBegan:Connect(KeyDown)
- UserInputService.InputEnded:Connect(KeyUp)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement