HowToRoblox

FireballScript

Nov 26th, 2019
1,889
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.09 KB | None | 0 0
  1. script.RemoteEvent.OnServerEvent:Connect(function(Player, Mouse)
  2.        
  3.     print("remote event fired")
  4.     local Fireball = game:GetService("ServerStorage").Fireball:Clone()
  5.     local Explosion = game:GetService("ServerStorage").Explosion:Clone()
  6.     local Character = Player.Character
  7.  
  8.    
  9.     Fireball.Position = Character.HumanoidRootPart.Position
  10.     Fireball.Parent = workspace
  11.     local velocity = Instance.new("BodyVelocity", Fireball)
  12.     velocity.Velocity = CFrame.new(Fireball.Position, Mouse).LookVector * 100
  13.  
  14.  
  15.     Fireball.Touched:Connect(function(Touched)
  16.         if Touched:IsDescendantOf(Character) then return end
  17.  
  18.         Explosion.Position = Fireball.Position
  19.         Fireball:Destroy()
  20.         Explosion.Parent = workspace
  21.        
  22.         if Touched.Parent:FindFirstChild("Humanoid") then
  23.             Touched.Parent:FindFirstChild("Humanoid"):TakeDamage(30)
  24.         end
  25.        
  26.         wait(2)
  27.         for i = 1, 300 do
  28.             Explosion.Fire.Size = Explosion.Fire.Size - 0.08
  29.             Explosion.Fire.Heat = Explosion.Fire.Heat - 0.03
  30.             wait()
  31.         end
  32.         Explosion:Destroy()
  33.     end)
  34. end)
Add Comment
Please, Sign In to add comment