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: help with players

Previous Thread :: Next Thread 
UltraTechX is not online. UltraTechX
Joined: 24 Oct 2013
Total Posts: 350
16 Aug 2014 11:01 AM
OK so i recently made a thread for my if statements, but i read that its because i need local scripts for local player to work properly, so can anyone tell me a way to take the players name and put it in a variable without local player?
Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
16 Aug 2014 11:04 AM
You say 'The player' but which player? if you want all players do this:

for i, v in pairs(game.Players:GetPlayers()) do
--v is the player.
end
Report Abuse
UltraTechX is not online. UltraTechX
Joined: 24 Oct 2013
Total Posts: 350
16 Aug 2014 11:11 AM
@above well you hit a button then it assigns your playername (your username) to a variable, but just the person clicking the button, not everyone
Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
16 Aug 2014 11:13 AM
script.Parent.ClickDetector.MouseClick:connect(function(player)
--player is the player.
end)
Report Abuse
UltraTechX is not online. UltraTechX
Joined: 24 Oct 2013
Total Posts: 350
16 Aug 2014 11:14 AM
can i use the player argument and assign it to a variable within the function but still make it available to other scripts?
Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
16 Aug 2014 11:16 AM
_G.player = player

then in another script just reference _G.player to get the player.
Report Abuse
UltraTechX is not online. UltraTechX
Joined: 24 Oct 2013
Total Posts: 350
16 Aug 2014 11:16 AM
sorry for more but is it player or player.Name for the username of the player
Report Abuse
UltraTechX is not online. UltraTechX
Joined: 24 Oct 2013
Total Posts: 350
16 Aug 2014 11:17 AM
ok thanks a bunch, ive been stuck on this for like 4 days
Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
16 Aug 2014 11:19 AM
player.Name is the username.
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