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: Mouse.Target not working

Previous Thread :: Next Thread 
benvoxomedia is not online. benvoxomedia
Joined: 28 Sep 2014
Total Posts: 98
21 Dec 2015 11:21 AM
When I hover over the part the mouse.target specifies it doesnt show the gui
script:
local mouse = game:GetService("Players").LocalPlayer:GetMouse()
if mouse.Target == workspace.CurtinOne then
game.StarterGui.Buttons.E.Visible = true
else
game.StarterGui:GetChildren().Visible = false
end
Report Abuse
Absurdism is not online. Absurdism
Joined: 18 Jul 2013
Total Posts: 2568
21 Dec 2015 11:23 AM
game.StarterGui:GetChildren().Visible = false

What are you trying to do here?
Report Abuse
benvoxomedia is not online. benvoxomedia
Joined: 28 Sep 2014
Total Posts: 98
21 Dec 2015 11:23 AM
I am trying to hide the guis when the mouse isnt hovering over the part
Report Abuse
Absurdism is not online. Absurdism
Joined: 18 Jul 2013
Total Posts: 2568
21 Dec 2015 11:27 AM
It's a bit more complicated than that.
You see, the GetChildren method returns a table of all of the ids of the parts. It doesn't return each individual part and iterate over them. You have to take initiative and iterate over all of the IDs that GetChildren returns.

Plus, ScreenGuis don't have a Visible property
Report Abuse
benvoxomedia is not online. benvoxomedia
Joined: 28 Sep 2014
Total Posts: 98
21 Dec 2015 11:31 AM
My new script is local mouse = game:GetService("Players").LocalPlayer:GetMouse()
if mouse.Target == workspace.CurtinOne then
game.StarterGui.Buttons.E.Visible = true
else
game.StarterGui.Buttons.E.Visible = false
end but it still wont work
Report Abuse
benvoxomedia is not online. benvoxomedia
Joined: 28 Sep 2014
Total Posts: 98
21 Dec 2015 11:44 AM
Bump
Report Abuse
IoIiderp is not online. IoIiderp
Joined: 05 Feb 2012
Total Posts: 8613
21 Dec 2015 11:45 AM
It will only check once.

Try this:

local mouse = game:GetService("Players").LocalPlayer:GetMouse()
mouse.Button1Down:connect(function()
if mouse.Target == workspace.CurtinOne then
game.StarterGui.Buttons.E.Visible = true
else
game.StarterGui:GetChildren().Visible = false
end
end)
Report Abuse
LilMcManiac is not online. LilMcManiac
Joined: 31 Oct 2011
Total Posts: 2812
21 Dec 2015 11:49 AM
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
mouse.Move:connect(function()
if mouse.Target and mouse.Target.Name == "CurtinOne" then
player.PlayerGui.Buttons.E.Visible = true
else
local children = player.PlayerGui:GetChildren()
local contents = {]
for _,v in pairs(children) do
if v.Visible == true then
table.insert(contents, v.Name)
for i = 1,#contents do
local gui = player.PlayerGui
if gui:FindFirstChlid(contents[i]) then
gui[contents[i]].Visible = false
end
end
end
end
end
end)



Did you know the chance of you being born was 1 in 400 trillion?
Report Abuse
benvoxomedia is not online. benvoxomedia
Joined: 28 Sep 2014
Total Posts: 98
21 Dec 2015 11:49 AM
@^ Its not working
Report Abuse
benvoxomedia is not online. benvoxomedia
Joined: 28 Sep 2014
Total Posts: 98
21 Dec 2015 11:52 AM
Thanks that works
Report Abuse
LilMcManiac is not online. LilMcManiac
Joined: 31 Oct 2011
Total Posts: 2812
21 Dec 2015 11:53 AM
It may have a couple of misspells in it, but after you fix those it works.

And your welcome.



Did you know the chance of you being born was 1 in 400 trillion?
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