|
| 23 Jul 2016 10:32 AM |
--Looks simple but fails.
local hand = script.Parent.Hand:GetChildren()
function MouseOver(frame) --returns true/false if the mouse is over a 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.Move:connect(function() print("mouse") for a, b in pairs(hand) do print("mouse2") if MouseOver(b) then print(MouseOver) print("Mouse is over "..b) end end end)
--When I move my mouse over a child of 'Hand' (I know for a fact there's nothing wrong with the hierarchy) it fails to advance past the 'if MouseOver(b)'. It prints mouse and mouse2.
|
|
|
| Report Abuse |
|
|
|
| 23 Jul 2016 10:39 AM |
if MouseY > TopBound and MouseY < BottomBound and MouseX > LeftBound and MouseX < RightBound then
You should clear this up with ('s and )'s. Also MouseY does not seem like its defined. |
|
|
| Report Abuse |
|
|
|
| 23 Jul 2016 10:41 AM |
| Oop. MouseY & X. I cut this from a larger script, I'll go check if I've messed up end's. |
|
|
| Report Abuse |
|
|