Advertisement
Guest User

Untitled

a guest
Jul 24th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. print("Hello world!")
  2.  
  3. local player = game.Players.LocalPlayer
  4. local mouse = player:GetMouse()
  5. local mouseup
  6. local hand = script.Parent.Hand:GetChildren()
  7. local mouseisover = nil
  8. repeat wait() until player.Character:FindFirstChild("Head")
  9.  
  10. function startbasics()
  11. local MouseX = 0
  12. local MouseY = 0
  13. local holding = false
  14.  
  15. local function MouseOver(frame) --returns true/false if the mouse is over a frame. (Or any GUI object)
  16. local TopBound = frame.AbsolutePosition.Y
  17. local BottomBound = frame.AbsolutePosition.Y + frame.AbsoluteSize.Y
  18. local LeftBound = frame.AbsolutePosition.X
  19. local RightBound = frame.AbsolutePosition.X + frame.AbsoluteSize.X
  20. if MouseY > TopBound and MouseY < BottomBound and MouseX > LeftBound and MouseX < RightBound then
  21. return true
  22. else
  23. return false
  24. end
  25. end
  26.  
  27. mouse.KeyDown:connect(function(key)
  28. print(key)
  29. end)
  30.  
  31. mouse.Move:connect(function()
  32. MouseX = mouse.X
  33. MouseY = mouse.Y
  34. for a, b in pairs(hand) do
  35. if MouseOver(b) then
  36. print(MouseX, MouseY)
  37. print("Mouse is over "..b.Name)
  38. mouseisover = b
  39. else
  40. mouseisover = nil
  41. end
  42. end
  43. print(mouseisover)
  44. end)
  45.  
  46. mouse.Button1Up:connect(function()
  47. mouseup = true
  48. if mouseisover ~= nil and holding == true then
  49. print("Dropped card")
  50. end
  51. end)
  52.  
  53. mouse.Button1Down:connect(function()
  54. mouseup = false
  55. print("Click")
  56. if mouseisover ~= nil then
  57. holding = true
  58. print("holding "..holding)
  59. end
  60. end)
  61. end
  62.  
  63. startbasics()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement