kittyabs
|
  |
| Joined: 24 Feb 2011 |
| Total Posts: 10297 |
|
|
| 08 May 2016 11:51 AM |
like if it was a regular gui i could just go player = script.parent.parent.whatever until i get out of player gui and hit the actual player
but since a surfacegui is in workspace, its not a descendant of a player that i can refer to by tracing it back to the hierarchy
there is a button a player has to hit so how could i access the player from there? |
|
|
| Report Abuse |
|
|
|
| 08 May 2016 11:56 AM |
People have been indexing Player by putting the SurfaceGui inside game.StarterGui
Then they type this in Command bar: game.StarterGui.SurfaceGui.Adornee = workspace.Part -- Define the real location of the Part.
You can now use a local script to see who clicked the button.
localscript:
script.Parent.MouseButton1Down:connect(function() print(game.Players.LocalPlayer.Name .. " has clicked the button") end)
|
|
|
| Report Abuse |
|
|
|
| 08 May 2016 12:00 PM |
Things you may run into problems with is it not replicate changes to other clients. This could be a good or bad thing.
|
|
|
| Report Abuse |
|
|
kittyabs
|
  |
| Joined: 24 Feb 2011 |
| Total Posts: 10297 |
|
|
| 08 May 2016 12:03 PM |
| wait so to do a local script it would be player = print(game.Players.LocalPlayer.Name .. " has clicked the button") |
|
|
| Report Abuse |
|
|
| |
|
|
| 08 May 2016 12:04 PM |
player = game.Players.LocalPlayer
|
|
|
| Report Abuse |
|
|
|
| 08 May 2016 12:05 PM |
PraetorianTheGod how would you get the character?
|
|
|
| Report Abuse |
|
|
kittyabs
|
  |
| Joined: 24 Feb 2011 |
| Total Posts: 10297 |
|
|
| 08 May 2016 12:06 PM |
| local script wouldnt work i think |
|
|
| Report Abuse |
|
|
|
| 08 May 2016 12:06 PM |
if hit.Parent:FindFirstChild("Humanoid") then local player = game.Players:GetPlayerFromCharacter(hit.Parent) |
|
|
| Report Abuse |
|
|
|
| 08 May 2016 12:07 PM |
if the surface gui is in startergui with the Adornee set to the part you want it will.
|
|
|
| Report Abuse |
|
|
kittyabs
|
  |
| Joined: 24 Feb 2011 |
| Total Posts: 10297 |
|
|
| 08 May 2016 12:07 PM |
its for a cash register so one user is inputting the price etc on one screen and there is a second screen with a button where the receiving user can press "accept" in order to have their account charged.
is there anyway i can index the user by seeing who pressed "accept"? since its some form of input |
|
|
| Report Abuse |
|
|
|
| 08 May 2016 12:09 PM |
PraetorianTheGod hes referring to a screengui button. Not an ontouched event button,
|
|
|
| Report Abuse |
|
|
kittyabs
|
  |
| Joined: 24 Feb 2011 |
| Total Posts: 10297 |
|
| |
|