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 » Scripting Helpers
Home Search
 

Re: GUI question

Previous Thread :: Next Thread 
Molarity is not online. Molarity
Joined: 16 Feb 2014
Total Posts: 1043
26 Jul 2014 10:18 PM
How do you know which player clicks on the ScreenGui in the StarterGui, just like how theres a player parameter in the OnClick method?
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
26 Jul 2014 10:19 PM
If you're writing in a localscript, it's game.Players.LocalPlayer.

If you're not: Why?
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
26 Jul 2014 10:19 PM
game.Players.LocalPlayer

And the player does not interact with the StarterGui, but the contents cloned into their PlayerGui
Report Abuse
InfiltrationFox is not online. InfiltrationFox
Joined: 15 Jul 2012
Total Posts: 453
26 Jul 2014 10:19 PM
gui.MouseButton1Click:connect(function(player)
print(player.Name)
end)
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
26 Jul 2014 10:20 PM
^nope. The player parameter is totally useless.
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
26 Jul 2014 10:20 PM
ScreenGuis aren't in starterguis if theyre being clicked on
Report Abuse
InfiltrationFox is not online. InfiltrationFox
Joined: 15 Jul 2012
Total Posts: 453
26 Jul 2014 10:21 PM
Its the same thing, so does it really matter which way you do it?
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
26 Jul 2014 10:22 PM
But the player parameter would be totally useless, if it actually existed.
Report Abuse
InfiltrationFox is not online. InfiltrationFox
Joined: 15 Jul 2012
Total Posts: 453
26 Jul 2014 10:25 PM
Okay you're right, so I feel crazy now.
Report Abuse
Molarity is not online. Molarity
Joined: 16 Feb 2014
Total Posts: 1043
26 Jul 2014 10:29 PM
Okay so game.Players.LocalPlayer will already tell you which player clicked on?

I tried this:
I placed a ScreenGui called quest that I want to clone to PlayerGui in ServerStorage.

In StarterGui, I place a local script:
local plyr = game.Players.LocalPlayer
local questBox = script.Parent.ScreenGui.Frame.TextButton --this works
questBox.MouseButton1Click:connect(function()
script.Parent.Parent.ServerStorage.quest:Clone().Parent = plyr.PlayerGui
end)


This results in:
ServerStorage is not a valid member of Player
Report Abuse
InfiltrationFox is not online. InfiltrationFox
Joined: 15 Jul 2012
Total Posts: 453
26 Jul 2014 10:30 PM
local plyr = game.Players.LocalPlayer
local questBox = script.Parent.ScreenGui.Frame.TextButton --this works
questBox.MouseButton1Click:connect(function()
script.Parent.Parent.Parent.Parent.ServerStorage.quest:Clone().Parent = plyr.PlayerGui
end)
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
26 Jul 2014 10:31 PM
A few problems:
1) ServerStorage only exists on the server. LocalScripts can't access it. Use ReplicatedStorage instead.
2) Not enough .Parents. (Why not just do game.ReplicatedStorage)
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
26 Jul 2014 10:32 PM
You can't access ServerStorage from LocalScripts.

InflitrationFox, come on ;)
Report Abuse
InfiltrationFox is not online. InfiltrationFox
Joined: 15 Jul 2012
Total Posts: 453
26 Jul 2014 10:32 PM
@smiley Maybe I should go to bed...
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
26 Jul 2014 10:34 PM
good night :P
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
26 Jul 2014 10:34 PM
You can't access ServerStorage from LocalScripts.
-------
Correct. But you can use RemoteEvents/Functions to get anything you need from ServerStorage.
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
26 Jul 2014 10:36 PM
@flateline

Just use ReplicatedStorage?
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
26 Jul 2014 10:36 PM
@flatline, incorrect. Sort of.
Report Abuse
Molarity is not online. Molarity
Joined: 16 Feb 2014
Total Posts: 1043
26 Jul 2014 10:37 PM
I see.
Report Abuse
Molarity is not online. Molarity
Joined: 16 Feb 2014
Total Posts: 1043
26 Jul 2014 10:38 PM
Thank you for your help.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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