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: Help: Gui Visibility change within functions

Previous Thread :: Next Thread 
Xwing245 is not online. Xwing245
Joined: 18 Feb 2012
Total Posts: 9
01 Oct 2016 10:14 PM
I can't seem to toggle visibility within this function. I am attempting to use a system where the gui appears when the mouse cursor is aimed at a part of a model that contains an object to distinguish it from other models. If the mouse is not on one of these distinguished models, the gui is expected to disappear, but I am unable to do so.

Here is the code that I have been running

local Player = Game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Label = script.Parent.ItemLabel

function MoveGui()
if Mouse.Target.Parent.Interface ~= nil then --Checks to see if Interface is part of the model that the mouse is pointing at
Label.Position = UDim2.new(0,Mouse.X-50,0,Mouse.Y-15)-- Puts Gui Element just above the cursor
Label.Text = Mouse.Target.Parent.NameForInterface.Value -- Sets Gui Text to Value within Model
Label.Visible = true
else Label.Visible = false
end
end

Mouse.Move:connect(MoveGui)
Report Abuse
Xwing245 is not online. Xwing245
Joined: 18 Feb 2012
Total Posts: 9
02 Oct 2016 11:01 AM
bump
Report Abuse
Xwing245 is not online. Xwing245
Joined: 18 Feb 2012
Total Posts: 9
02 Oct 2016 02:30 PM
bump
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
02 Oct 2016 02:35 PM
--Stop capitalizing everything and 'Game' doesnt exist

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local label = script.Parent.ItemLabel

mouse.Move:connect(function()
if mouse.Target and mouse.Target.Parent:FindFirstChild('Interface') then
label.Position = UDim2.new(0,mouse.X-50,0,mouse.Y-15)
label.Text = mouse.Target.Parent.NameForInterface.Value
label.Visible = true
else
label.Visible = false
end
end)


Report Abuse
DataRoot is not online. DataRoot
Joined: 07 Apr 2016
Total Posts: 586
02 Oct 2016 02:36 PM
YES YES YES https://www.youtube.com/watch?v=OLuvQoF1o58
Report Abuse
IndustrialOrc is not online. IndustrialOrc
Joined: 10 Sep 2016
Total Posts: 327
02 Oct 2016 02:41 PM
@Time

1. Stop hating on PascalCase, it's just his preference.
2. While I agree it shouldn't be used, Game exists- it's just deprecated.
Report Abuse
Xwing245 is not online. Xwing245
Joined: 18 Feb 2012
Total Posts: 9
02 Oct 2016 06:14 PM
That works.
Report Abuse
Xwing245 is not online. Xwing245
Joined: 18 Feb 2012
Total Posts: 9
02 Oct 2016 07:57 PM
I just tried to use the same script in a regular Roblox game instead of studio.
The Gui Does not react to the player's mouse movement. Yes, I am using a local script
@time

Any help?

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local label = script.Parent.ItemLabel

mouse.Move:connect(function()
if mouse.Target and mouse.Target.Parent:FindFirstChild('NameForInterface') then
label.Position = UDim2.new(0,mouse.X-50,0,mouse.Y-15)
label.Text = mouse.Target.Parent.NameForInterface.Value
label.Visible = true
else
label.Visible = false
end
end)
Report Abuse
Xwing245 is not online. Xwing245
Joined: 18 Feb 2012
Total Posts: 9
02 Oct 2016 10:00 PM
bump
Report Abuse
Xwing245 is not online. Xwing245
Joined: 18 Feb 2012
Total Posts: 9
02 Oct 2016 10:37 PM
bump
Report Abuse
Xwing245 is not online. Xwing245
Joined: 18 Feb 2012
Total Posts: 9
03 Oct 2016 05:28 PM
bump
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