Advertisement
HowToRoblox

BowClient

Nov 5th, 2021
2,398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.39 KB | None | 0 0
  1. local mouse = game.Players.LocalPlayer:GetMouse()
  2. local buttonDown = false
  3.  
  4. mouse.Button1Down:Connect(function()
  5.     buttonDown = true
  6. end)
  7.  
  8. mouse.Button1Up:Connect(function()
  9.    
  10.     script.Parent.BowRE:FireServer("shoot", script.Parent.Bow.Middle.Position.Z, mouse.Hit)
  11.    
  12.     buttonDown = false
  13. end)
  14.  
  15.  
  16. game:GetService("RunService").RenderStepped:Connect(function()
  17.    
  18.     if buttonDown then
  19.         script.Parent.Bow.Middle.Position = script.Parent.Bow.Middle.Position:Lerp(Vector3.new(0, 0, 1.998), 0.1)
  20.        
  21.     else   
  22.         script.Parent.Bow.Middle.Position = script.Parent.Bow.Middle.Position:Lerp(Vector3.new(0, 0, 0.637), 0.7)
  23.     end
  24.    
  25.     script.Parent.Bow.Weld.C1 = CFrame.new(-Vector3.new(0, 0, script.Parent.Bow.Middle.Position.Z - 0.7))
  26. end)
  27.  
  28.  
  29. script.Parent.BowRE.OnClientEvent:Connect(function(arrow, charge)
  30.    
  31.     arrow:Destroy()
  32.    
  33.     local newArrow = script.Parent.Arrow:Clone()
  34.     newArrow.Parent = workspace
  35.  
  36.     newArrow.Transparency = 0
  37.  
  38.     newArrow.CFrame = CFrame.new(newArrow.Position, mouse.Hit.Position)
  39.  
  40.     newArrow.Velocity = mouse.Hit.LookVector * charge * 200
  41.    
  42.    
  43.     newArrow.Touched:Connect(function(hit)
  44.  
  45.         if hit.Parent ~= game.Players.LocalPlayer.Character and hit.Parent.Parent ~= game.Players.LocalPlayer.Character then
  46.  
  47.             newArrow:Destroy()
  48.         end
  49.     end)
  50. end)
  51.  
  52.  
  53. while wait(0.1) do
  54.    
  55.     script.Parent.BowRE:FireServer("string", script.Parent.Bow.Middle.Position, script.Parent.Bow.Weld.C1)
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement