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 » Scripting Helpers
Home Search
 

Mouse and GUI problems.

Previous Thread :: Next Thread 
WhoBloxedWho is not online. WhoBloxedWho
Joined: 25 Mar 2009
Total Posts: 4611
25 Nov 2011 02:50 PM
the script moves a GUI to the mouses position, and the GUI supost to change color if the mouse.Target is a humanoid. It's having trouble finding the humanoid, or it's just not changing.


wait(1.4)

bin = script.Parent
Player = script.Parent.Parent.Parent
HUD = Player.PlayerGui.HUD

function onSelected(mouse)
if mouse == nil then return end
while true do
wait()
if bin.Active == false then
HUD.CrossHairX.Visible = false
HUD.CrossHairY.Visible = false
elseif bin.Active == true then
HUD.CrossHairX.Visible = true
HUD.CrossHairY.Visible = true
HUD.CrossHairX.Position = UDim2.new(0,mouse.X-5000,0,mouse.Y)
HUD.CrossHairY.Position = UDim2.new(0,mouse.X,0,mouse.Y-5000)
end

if mouse.Target ~= nil then
Object = mouse.Target
ObjParent = Object.Parent:GetChildren()
for X = 1, # ObjParent do
if ObjParent[X] ~= nil then
if ObjParent[X].ClassName == Humanoid then
HUD.CrossHairX.BorderColor3 = HUD.Red.Value
HUD.CrossHairY.BorderColor3 = HUD.Red.Value
else
HUD.CrossHairX.BorderColor3 = HUD.Green.Value
HUD.CrossHairY.BorderColor3 = HUD.Green.Value
end
end
end
end
end
end


bin.Selected:connect(onSelected)



The GUI follows the mouse perfectly, but it wont change colors. Any help?
Report Abuse
WhoBloxedWho is not online. WhoBloxedWho
Joined: 25 Mar 2009
Total Posts: 4611
25 Nov 2011 04:36 PM
Nothing :c?
Report Abuse
MrChubbs is not online. MrChubbs
Joined: 14 Oct 2010
Total Posts: 4969
25 Nov 2011 05:17 PM
I dont think your while loop is working correctly, plus if my mouse is hovering over 3,2,0 then you wont even see the GUI.
Report Abuse
WhoBloxedWho is not online. WhoBloxedWho
Joined: 25 Mar 2009
Total Posts: 4611
25 Nov 2011 05:48 PM
Your going to see the GUI over 3,2,0. mouse.X and mouse.Y are screen coordinated, and because your screen is 3D, theres no need for a Z axis.
Report Abuse
WhoBloxedWho is not online. WhoBloxedWho
Joined: 25 Mar 2009
Total Posts: 4611
25 Nov 2011 05:48 PM
2D*

Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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