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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 26 Jul 2014 10:19 PM |
gui.MouseButton1Click:connect(function(player) print(player.Name) end) |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2014 10:20 PM |
| ^nope. The player parameter is totally useless. |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 26 Jul 2014 10:21 PM |
| Its the same thing, so does it really matter which way you do it? |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2014 10:22 PM |
| But the player parameter would be totally useless, if it actually existed. |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2014 10:25 PM |
| Okay you're right, so I feel crazy now. |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 26 Jul 2014 10:32 PM |
| @smiley Maybe I should go to bed... |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
| |
|
|
| 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
|
  |
| Joined: 28 Jun 2008 |
| Total Posts: 15773 |
|
|
| 26 Jul 2014 10:36 PM |
@flateline
Just use ReplicatedStorage? |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2014 10:36 PM |
| @flatline, incorrect. Sort of. |
|
|
| Report Abuse |
|
|
Molarity
|
  |
| Joined: 16 Feb 2014 |
| Total Posts: 1043 |
|
| |
|
Molarity
|
  |
| Joined: 16 Feb 2014 |
| Total Posts: 1043 |
|
| |
|