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: Why Does This Not Work?

Previous Thread :: Next Thread 
bloberous is not online. bloberous
Joined: 07 Jun 2009
Total Posts: 299
29 Jul 2016 08:09 AM
I'm trying to make the text on a GUI change depending on what object your mouse is hovered over. This is what I have so far and it does not work but neither does it give me errors.

--

local mouse = player:GetMouse()
local target = mouse.Target
local playergui = game.Players.LocalPlayer.PlayerGui

while true do
wait()
text = ""
if target ~= nil then
if target:findFirstChild"examine" then
text = "Examine"
end
end
playergui.ScreenGui.Text.Text = text
end
Report Abuse
phoenix53124 is not online. phoenix53124
Joined: 25 Feb 2009
Total Posts: 4889
29 Jul 2016 08:15 AM
You have to update the target. Just doing that means it'll never change after it's been assigned.

local player, mouse, playergui, target = game.Players.LocalPlayer --I just declare them all at once. Then they're local for the rest of the code.
mouse = player:GetMouse()
playergui = player.PlayerGui

while wait(.3) do
target = mouse.Target
playergui.ScreenGui.Text.Text = target and "Examine" or ""
end
Report Abuse
bloberous is not online. bloberous
Joined: 07 Jun 2009
Total Posts: 299
29 Jul 2016 08:22 AM
Thanks a lot! Never noticed it because I try to keep my script nice and clean with all stating at the start.

Also, with the local variables I never really learned the difference between the two?
Report Abuse
bloberous is not online. bloberous
Joined: 07 Jun 2009
Total Posts: 299
29 Jul 2016 08:32 AM
Nevermind. Don't answer that last question. Post closed.
Report Abuse
PurelyMystic is not online. PurelyMystic
Joined: 24 May 2010
Total Posts: 931
29 Jul 2016 08:34 AM
Why not
script.Parent.MouseEnter:connect(function()
script.Parent.Text = "B;aj"
end)
script.Parent.MouseLeave:connect(function()
script.Parent.Text = "Return to normal..."
end)
You can use a local script so only client side can see the changes...
Report Abuse
Invalid_Permissions is not online. Invalid_Permissions
Joined: 07 Jul 2013
Total Posts: 2633
29 Jul 2016 10:08 AM
bump

you cant close the post dummy


ᕦ(⊜ل͜⊜)ᕥ
Report Abuse
casperm8 is not online. casperm8
Joined: 15 Sep 2008
Total Posts: 425
29 Jul 2016 10:14 AM
We will all see your shame....
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