Advertisement
mr2meows

teleport

Nov 6th, 2017
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. --- SonOfSevenless
  2. print("Teleport Spell Loaded")
  3.  
  4. local COOLDOWN = 0
  5. local MP = 0
  6.  
  7.  
  8.  
  9. bin = script.Parent
  10.  
  11. function TryToCast(player)
  12. -- returns true if player may cast this spell
  13.  
  14. -- make sure this player has the wizard board stats
  15. local stats = player:findFirstChild("leaderstats")
  16. if stats == nil then return false end
  17. local mana = stats:findFirstChild("Mana")
  18. local level = stats:findFirstChild("Level")
  19. if mana == nil or level == nil then return false end
  20.  
  21. if (mana.Value >= MP) then
  22. mana.Value = mana.Value - MP
  23. return true
  24. end
  25.  
  26. return false
  27. end
  28.  
  29.  
  30.  
  31.  
  32. function teleportPlayer(pos)
  33.  
  34. local player = game.Players.LocalPlayer
  35. if player == nil or player.Character == nil then return end
  36.  
  37. local char = player.Character.Torso
  38.  
  39. sound = Instance.new("Sound")
  40. sound.SoundId = ""
  41. sound.Parent = char
  42. sound.PlayOnRemove = true
  43. sound:remove()
  44.  
  45. char.CFrame = CFrame.new(Vector3.new(pos.x, pos.y + 7, pos.z))
  46.  
  47.  
  48. sound = Instance.new("Sound")
  49. sound.SoundId = ""
  50. sound.Parent = char
  51. sound.PlayOnRemove = true
  52. sound:remove()
  53.  
  54. end
  55.  
  56.  
  57. enabled = true
  58. function onButton1Down(mouse)
  59. if not enabled then
  60. return
  61. end
  62.  
  63. local player = game.Players.LocalPlayer
  64. if player == nil then return end
  65. --if TryToCast(player) == false then return end
  66.  
  67.  
  68. enabled = false
  69. mouse.Icon = "rbxasset://textures\\ArrowFarCursor.png"
  70.  
  71. -- find the best cf
  72. local cf = mouse.Hit
  73. local v = cf.lookVector
  74.  
  75. teleportPlayer(cf.p)
  76.  
  77. wait(COOLDOWN)
  78. mouse.Icon = "rbxasset://textures\\ArrowCursor.png"
  79. enabled = true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement