Advertisement
Er1x_Official

advanced fireball local script

Jan 23rd, 2022
681
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.92 KB | None | 0 0
  1. local control = script.Parent -- gui
  2. local mouse = game:GetService("Players").LocalPlayer:GetMouse() -- mouse
  3. local remote = control:WaitForChild("DAMNFIRE") -- remote event
  4. local uis = game:GetService("UserInputService") -- input service (detect key pressed)
  5. local holding = false
  6.  
  7. uis.InputBegan:Connect(function(i,x) -- uis keypressed function
  8.     if not x then -- check if player is not typing in chat or in a gui
  9.         if i.KeyCode == Enum.KeyCode.F then -- check if the player has pressed the button
  10.             holding = true
  11.             remote:FireServer("START")
  12.            
  13.             while true do
  14.                 if holding then
  15.                     remote:FireServer("HOLDING")
  16.                 else
  17.                     break
  18.                 end
  19.                
  20.                 task.wait()
  21.             end
  22.         end
  23.     end
  24. end)
  25.  
  26. uis.InputEnded:Connect(function(i,x)
  27.     if not x then
  28.         if i.KeyCode == Enum.KeyCode.F then
  29.             task.wait(.1)
  30.             holding = false
  31.             remote:FireServer("FIRE",mouse.Hit.Position)
  32.             print("released")
  33.         end
  34.     end
  35. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement