|
| 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 |
|
|
| |
|
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 |
|
|
|
| 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 |
|
|
| |
|