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: how would i index a player from a surfacegui

Previous Thread :: Next Thread 
kittyabs is not online. 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
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
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
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
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 is not online. 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
PraetorianTheGod is not online. PraetorianTheGod
Joined: 02 May 2014
Total Posts: 814
08 May 2016 12:04 PM
:GetPlayerFromCharacter()
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
08 May 2016 12:04 PM
player = game.Players.LocalPlayer


Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
08 May 2016 12:05 PM
PraetorianTheGod how would you get the character?


Report Abuse
kittyabs is not online. kittyabs
Joined: 24 Feb 2011
Total Posts: 10297
08 May 2016 12:06 PM
local script wouldnt work i think
Report Abuse
PraetorianTheGod is not online. PraetorianTheGod
Joined: 02 May 2014
Total Posts: 814
08 May 2016 12:06 PM
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
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 is not online. 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
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
08 May 2016 12:09 PM
PraetorianTheGod hes referring to a screengui button. Not an ontouched event button,


Report Abuse
kittyabs is not online. kittyabs
Joined: 24 Feb 2011
Total Posts: 10297
08 May 2016 12:15 PM
can it be done////?????
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