Advertisement
SxScripting

SxS Striker FireBall

Jul 25th, 2020
2,989
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.63 KB | None | 0 0
  1. -- local Script
  2. local Keybind = "E"
  3. local Cooldown = 1
  4.  
  5. local UIS = game:GetService("UserInputService")
  6. local RS = game:GetService("ReplicatedStorage")
  7. local Deb = false
  8.  
  9. UIS.InputBegan:Connect(function(Input)
  10.     if Input.KeyCode == Enum.KeyCode[Keybind] and not Deb then
  11.         Deb = true
  12.         RS.FireBallEvent:FireServer(game.Players.LocalPlayer:GetMouse().Hit.p)
  13.         wait(Cooldown)
  14.         Deb = false
  15.     end
  16. end)
  17. --- Server Script
  18.  
  19. local Speed = 100
  20. local Survive = 1
  21. local Damage = 12
  22.  
  23. local RS = game:GetService("ReplicatedStorage")
  24.  
  25. RS.FireBallEvent.OnServerEvent:Connect(function(plr, HitPos)
  26.     if plr and plr.Character and plr.Character.PrimaryPart and plr.Character:FindFirstChild("Humanoid") then
  27.         local Clone = RS.Fireball:Clone()
  28.         Clone.Parent = workspace
  29.         Clone.Position = plr.Character.PrimaryPart.CFrame:PointToWorldSpace(Vector3.new(0,0,-5))
  30.        
  31.         local BV = Instance.new("BodyVelocity", Clone)
  32.         BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  33.         BV.P = math.huge
  34.         BV.Velocity = CFrame.new(Clone.Position,HitPos).LookVector * Speed
  35.         local Deb = {}
  36.         Clone.Touched:Connect(function(Hit)
  37.             if Hit.Parent:FindFirstChild("Humanoid") then
  38.                 if not table.find(Deb, Hit.Parent.Humanoid) and Hit.Parent.Humanoid ~= plr.Character:FindFirstChild("Humanoid") then
  39.                     table.insert(Deb, Hit.Parent.Humanoid)
  40.                     game.Debris:AddItem(Clone,.2)
  41.                     Hit.Parent.Humanoid:TakeDamage(Damage)
  42.                 end
  43.             end
  44.         end)
  45.         game.Debris:AddItem(Clone, Survive)
  46.     end
  47. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement