Advertisement
jordan83221

Ice Lance

Nov 29th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.88 KB | None | 0 0
  1. wait()
  2. local next=next
  3. local pcall=pcall
  4. local d=script.Distance
  5. local p=script.Player
  6. local t=script.Target
  7. local s=script.Spellpower
  8. local c=script.CritChance
  9. local casting=p.Value.Backpack.Casting
  10. local mana=p.Value.Backpack.Mana
  11. local manacap=p.Value.Backpack.MaxMana
  12. local th=t.Value.Health
  13. local oldC=c.Value
  14. local function randomChance(percent)
  15.     return percent>=math.random(1,100)
  16. end
  17. local function sendmsg(text,c)
  18.     local thing=Instance.new("StringValue",game.Workspace)
  19.     thing.Name="SpellDamage"
  20.     thing.Value=text
  21.     local thing2=Instance.new("BoolValue",thing)
  22.     thing2.Name=t.Value.Parent.Name
  23.     thing2.Value=c
  24.     wait()
  25.     thing:Destroy()
  26. end
  27. local function animLance()
  28.    
  29. end
  30. pcall(function()
  31.     if not casting.Value==true then
  32.         casting.Value=true
  33.         local dmg=((.335*s.Value)+math.random(306,392))
  34.         if t.Value.Frozen.Value==true then
  35.             c.Value=(c.Value*1.5)+50
  36.             mana.Value=mana.Value-(manacap.Value*.01)
  37.             if not randomChance(c.Value) then
  38.                 if th.Value-(dmg*4)>=0 then
  39.                     th.Value=math.ceil(th.Value-(dmg*4))
  40.                     sendmsg(4*dmg,false)
  41.                 else
  42.                     th.Value=0
  43.                 end
  44.             else
  45.                 if th.Value-(th.Value-((2*dmg)*3))>=0 then
  46.                     th.Value=math.ceil(th.Value-((2*dmg)*3))
  47.                     sendmsg(2*dmg*4,true)
  48.                 else
  49.                     th.Value=0
  50.                 end
  51.             end
  52.             casting.Value=false
  53.             script.Disabled=true
  54.             script:Destroy()
  55.         else
  56.             mana.Value=mana.Value-(manacap.Value*.01)
  57.             c.Value=oldC
  58.             if not randomChance(c.Value) then
  59.                 if th.Value-(th.Value-(dmg))>=0 then
  60.                     th.Value=math.ceil(th.Value-(dmg))
  61.                     sendmsg(dmg,false)
  62.                 else
  63.                     th.Value=0
  64.                 end
  65.             else
  66.                 if th.Value-(2*dmg)>=0 then
  67.                     th.Value=math.ceil(th.Value-(2*dmg))
  68.                     sendmsg(2*dmg,true)
  69.                 else
  70.                     th.Value=0
  71.                 end
  72.             end
  73.             casting.Value=false
  74.             script.Disabled=true
  75.             script:Destroy()
  76.         end
  77.     else
  78.         script.Disabled=true
  79.         script:Destroy()
  80.     end
  81. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement