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: 60 character limit... what?

Previous Thread :: Next Thread 
200AB is not online. 200AB
Joined: 24 Aug 2010
Total Posts: 1604
18 Apr 2012 02:30 PM
I just thought about something, I've been using shared to reference functions cross-script, and some of the functions I use with shared are inside scripts that are children of StarterGui's, which will be inside every player once the game starts, and if I have to, for example, show a certain Gui, in said functions, I'll usually just do something like script.parent.Frame.Visible = true

So, say I want to call a function:
Player.PlayerGui.ScreenGui.TextLabel.Script
and 'Script' script is:
function dosomething(text)
script.Parent.Visible = true
script.Parent.Text = text
end

shared.dosomething = dosomething
(end of script)

What would happen? Would all players that have that Gui now have it visible with that text?

Or would it somehow only happen to the player that the script that called shared.dosomething was handling currently?

Just something I was thinking about. :P
Report Abuse
Aaaboy97 is not online. Aaaboy97
Joined: 05 Apr 2009
Total Posts: 6612
18 Apr 2012 02:46 PM
It would not work how you expect

script does not change based on the function that's calling it

HOWEVER, you could do this:

shared.dosomething = function(Script, text)
Script.Parent.Visible = true
Script.Parent.Text = text
end



Notice how you call it like this: shared.dosomething(script, "Hello world!")

Since you pass the variable "script" into the global function, this will work how you expected it to.
Report Abuse
200AB is not online. 200AB
Joined: 24 Aug 2010
Total Posts: 1604
18 Apr 2012 02:51 PM
(^Lolsubject)

I see, so it's probably best to just not have global functions inside PlayerGui's. :P

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