Advertisement
Guest User

Untitled

a guest
Jul 26th, 2014
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.94 KB | None | 0 0
  1. Player =script.Parent.Parent.Parent
  2. m = Player:GetMouse()
  3. wand = script.Parent
  4. function eq()
  5. wand.Eq.Value = true
  6. end
  7. wand.Equipped:connect(eq)
  8. function uneq()
  9. wand.Eq.Value = false
  10. end
  11. wand.Unequipped:connect(uneq)
  12.  
  13. n = false
  14. on = false
  15. spell1 = false
  16. m.KeyDown:connect(function(key)
  17.         if wand.Eq.Value ==false then return end
  18.         if wand.SpellActive.Value == true then return end
  19.         if key =='y' then
  20.                 if spell1 ==false then
  21.                         spell1 = true
  22.                         if on ==false then
  23.                         on =true
  24.                         if m.Target ~=nil then
  25.                                 x = m.Target
  26.                                 if x.Parent.ClassName =='Tool' then
  27.                                 n = true
  28.                                 end
  29.                                 chat = wand.SpellN:clone()
  30.                                 chat.Parent = Player.Character.Head
  31.                                 chat.Enabled = true
  32.                                 if m.Target.Anchored ==true or m.Target.Locked ==true then return end
  33.                                 if n == false then
  34.                                 --game:GetService("Chat"):Chat(Player.Character.Head, "Accio " ..x.Name)
  35.                                 chat.SpellName.Text = 'Accio' ..x.Name
  36.                                 print("accio" ..x.Name)
  37.                                 elseif n ==true then
  38.                                 --game:GetService("Chat"):Chat(Player.Character.Head, "Accio " ..x.Parent.Name)
  39.                                 chat.SpellName.Text = 'Accio' ..x.Parent.Name
  40.         print('accio' ..x.Parent.Name)
  41.                                 end
  42.                                 accio = Instance.new("BodyPosition", x)
  43.                                 accio.position = Player.Character["Right Arm"].Position
  44.                                 accio.Parent.Touched:connect(function(hit)
  45.                                 local bp = Player.Character:GetChildren()
  46.                                 if hit == Player.Character.Torso or  hit == Player.Character["Right Arm"] or hit == Player.Character["Left Arm"]then
  47.                                 accio.maxForce = Vector3.new(0,0,0)
  48.                                 x.Anchored = true
  49.                                 wait(0.01)
  50.                                 x.Anchored = false
  51.                                 on = false
  52.                                 spell1 = false
  53.                                 on = false
  54.                                 n = false
  55.                                 end
  56.                                 end)
  57.                                 spell1 = false
  58.                                 on = false
  59.                                 game.Debris:AddItem(accio, 4)
  60.                                 n = false
  61.                             Player.Character.Head.SpellN:Destroy()
  62.                                 end
  63.                                 end
  64.                         end
  65.         end
  66. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement