generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Absolute position function not working

Previous Thread :: Next Thread 
ASpoonfullOfSucrose is not online. ASpoonfullOfSucrose
Joined: 28 Oct 2015
Total Posts: 442
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
GNUnotUNIX is not online. GNUnotUNIX
Joined: 05 Feb 2012
Total Posts: 15171
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
ASpoonfullOfSucrose is not online. ASpoonfullOfSucrose
Joined: 28 Oct 2015
Total Posts: 442
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image