Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Hello world!")
- local player = game.Players.LocalPlayer
- local mouse = player:GetMouse()
- local mouseup
- local hand = script.Parent.Hand:GetChildren()
- local mouseisover = nil
- repeat wait() until player.Character:FindFirstChild("Head")
- function startbasics()
- local MouseX = 0
- local MouseY = 0
- local holding = false
- local function MouseOver(frame) --returns true/false if the mouse is over a frame. (Or any GUI object)
- local TopBound = frame.AbsolutePosition.Y
- local BottomBound = frame.AbsolutePosition.Y + frame.AbsoluteSize.Y
- local LeftBound = frame.AbsolutePosition.X
- local RightBound = frame.AbsolutePosition.X + frame.AbsoluteSize.X
- if MouseY > TopBound and MouseY < BottomBound and MouseX > LeftBound and MouseX < RightBound then
- return true
- else
- return false
- end
- end
- mouse.KeyDown:connect(function(key)
- print(key)
- end)
- mouse.Move:connect(function()
- MouseX = mouse.X
- MouseY = mouse.Y
- for a, b in pairs(hand) do
- if MouseOver(b) then
- print(MouseX, MouseY)
- print("Mouse is over "..b.Name)
- mouseisover = b
- else
- mouseisover = nil
- end
- end
- print(mouseisover)
- end)
- mouse.Button1Up:connect(function()
- mouseup = true
- if mouseisover ~= nil and holding == true then
- print("Dropped card")
- end
- end)
- mouse.Button1Down:connect(function()
- mouseup = false
- print("Click")
- if mouseisover ~= nil then
- holding = true
- print("holding "..holding)
- end
- end)
- end
- startbasics()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement