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 do I get players from @ S3RV3R SCR1PT

Previous Thread :: Next Thread 
Eventive is not online. Eventive
Joined: 28 Jul 2011
Total Posts: 9827
27 Feb 2017 01:29 PM
My code needs to run when there is two players, and I refer to player a lot, but how do I get a player from a S3#v############it's not triggered by a hit function on PlayerAdded function.

Code:

local RE = game.ReplicatedStorage:WaitForChild("GameEvent")
local round = false
local choose = false
local afk = false
local playing = false
local player = ----- ??????? HELP
local label = player.PlayerGui.Main.Frame.Label
local time = player.PlayerGui.Main.Frame.Time
repeat wait() until player.Character
local char = player.Character

if game.Players.NumPlayers >= 2 then
print('Connected!')
---- Intermission ----
if not round then
print('Intermission')
label.Text = "Intermission"
for i = 15, 0, -1 do
time.Text = i
wait(1)
choose = true
end
end

---- Choose Element ----
if choose then
print('Choosing!')
label.Text = "Choose your Element!"
for i = 10, 0, -1 do
time.Text = i
wait(1)
round = true
end
end

---- Round ----

if round then
print('Round!')
label.Text = "Round in Progress"
for i = 120, 0, -1 do
time.Text = i
wait(1)
round = false
end
end
end


ATR'er since 2013.
Report Abuse
Eventive is not online. Eventive
Joined: 28 Jul 2011
Total Posts: 9827
27 Feb 2017 02:00 PM
FE is on btw


ATR'er since 2013.
Report Abuse
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
27 Feb 2017 02:09 PM
game.Players:GetChildren() makes a table of all players, then you can use a loop to iterate over each player
Report Abuse
Eventive is not online. Eventive
Joined: 28 Jul 2011
Total Posts: 9827
27 Feb 2017 02:14 PM
Can you give me an example pls


ATR'er since 2013.
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
27 Feb 2017 02:17 PM


for i,v in next, game.Payers:GetPlayers() do

end


Report Abuse
Eventive is not online. Eventive
Joined: 28 Jul 2011
Total Posts: 9827
27 Feb 2017 02:22 PM
"ServerScriptService.Scripts.GameScripts.Main:7: attempt to index field 'PlayerGui' (a nil value)

New Code:
local RE = game.ReplicatedStorage:WaitForChild("GameEvent")
local round = false
local choose = false
local afk = false
local playing = false
local player = game.Players:GetChildren()
local label = player.PlayerGui.Main.Frame.Label
local time = player.PlayerGui.Main.Frame.Time
repeat wait() until player.Character
local char = player.Character

for i,v in next, game.Playerss:GetPlayers() do
if game.Players.NumPlayers >= 2 then
print('Connected!')
---- Intermission ----
if not round then
print('Intermission')
label.Text = "Intermission"
for i = 15, 0, -1 do
time.Text = i
wait(1)
choose = true
end
end

---- Choose Element ----
if choose then
print('Choosing!')
label.Text = "Choose your Element!"
for i = 10, 0, -1 do
time.Text = i
wait(1)
round = true
end
end

---- Round ----

if round then
print('Round!')
label.Text = "Round in Progress"
for i = 120, 0, -1 do
time.Text = i
wait(1)
round = false
end
end
end
end

Line:
local label = player.PlayerGui.Main.Frame.Label



ATR'er since 2013.
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
27 Feb 2017 02:24 PM
game.Players *


Report Abuse
Eventive is not online. Eventive
Joined: 28 Jul 2011
Total Posts: 9827
27 Feb 2017 02:28 PM
fixed that
not working


ATR'er since 2013.
Report Abuse
Eventive is not online. Eventive
Joined: 28 Jul 2011
Total Posts: 9827
27 Feb 2017 02:30 PM
my whole script isn't working


same error

how2fix?


ATR'er since 2013.
Report Abuse
Eventive is not online. Eventive
Joined: 28 Jul 2011
Total Posts: 9827
27 Feb 2017 02:31 PM
should I define the player after the for i,v in next?


ATR'er since 2013.
Report Abuse
IcedVapour is not online. IcedVapour
Joined: 10 Nov 2013
Total Posts: 2741
27 Feb 2017 02:39 PM
Guessing you are using FE. You cannot access PlayerGui with # ############ with FE enabled
Report Abuse
Eventive is not online. Eventive
Joined: 28 Jul 2011
Total Posts: 9827
27 Feb 2017 02:46 PM
you can access playergui with FE.


ATR'er since 2013.
Report Abuse
IcedVapour is not online. IcedVapour
Joined: 10 Nov 2013
Total Posts: 2741
27 Feb 2017 02:48 PM
https://forum.roblox.com/Forum/ShowPost.aspx?PostID=188224284

"but with FE it cannot access PlayerGui"
Report Abuse
Snowskateer is not online. Snowskateer
Joined: 06 Dec 2011
Total Posts: 4647
27 Feb 2017 02:50 PM
:GetChildren() returns a table
you need to iterate through it to get individual players

Report Abuse
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
27 Feb 2017 02:53 PM
local players = game.Players:GetChildren()
for _,v in pairs(players) do
v.PlayerGui.--add stuff here
end
Report Abuse
IcedVapour is not online. IcedVapour
Joined: 10 Nov 2013
Total Posts: 2741
27 Feb 2017 02:54 PM
@Mister


"v.PlayerGui"

again you cannot access playergui from server scripts
Report Abuse
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
27 Feb 2017 03:00 PM
http://wiki.roblox.com/index.php?title=API:Class/PlayerGui
Report Abuse
IcedVapour is not online. IcedVapour
Joined: 10 Nov 2013
Total Posts: 2741
27 Feb 2017 03:01 PM
@Mister

He is using FE ffs read the above posts
Report Abuse
Eventive is not online. Eventive
Joined: 28 Jul 2011
Total Posts: 9827
27 Feb 2017 03:05 PM
It's not working, but I might be doing something wrong, here is my code: (All in # ############ btw) for _,v in pairs(players) do if game.Players.NumPlayers >= 2 then print('Connected!') ---- Intermission ---- if not round then print('Intermission') v.PlayerGui.Main.Frame.Text = "Intermission" for i = 15, 0, -1 do v.PlayerGui.Main.Frame.time.Text = i wait(1) choose = true end end ---- Choose Element ---- if choose then print('Choosing!') v.PlayerGui.Main.Frame.label.Text = "Choose your Element!" for i = 10, 0, -1 do v.PlayerGui.Main.Frame.time.Text = i wait(1) round = true end end ---- Round ---- if round then print('Round!') v.PlayerGui.Main.Frame.label.Text = "Round in Progress" for i = 120, 0, -1 do v.PlayerGui.Main.Frame.time.Text = i wait(1) round = false end end end end ATR'er since 2013.
Report Abuse
Eventive is not online. Eventive
Joined: 28 Jul 2011
Total Posts: 9827
27 Feb 2017 03:06 PM
for _,v in pairs(players) do
if game.Players.NumPlayers >= 2 then
print('Connected!')
---- Intermission ----
if not round then
print('Intermission')
v.PlayerGui.Main.Frame.Text = "Intermission"
for i = 15, 0, -1 do
v.PlayerGui.Main.Frame.time.Text = i
wait(1)
choose = true
end
end

---- Choose Element ----
if choose then
print('Choosing!')
v.PlayerGui.Main.Frame.label.Text = "Choose your Element!"
for i = 10, 0, -1 do
v.PlayerGui.Main.Frame.time.Text = i
wait(1)
round = true
end
end

---- Round ----

if round then
print('Round!')
v.PlayerGui.Main.Frame.label.Text = "Round in Progress"
for i = 120, 0, -1 do
v.PlayerGui.Main.Frame.time.Text = i
wait(1)
round = false
end
end
end
end

in a S3RV3R SCR1PT


ATR'er since 2013.
Report Abuse
Eventive is not online. Eventive
Joined: 28 Jul 2011
Total Posts: 9827
27 Feb 2017 03:07 PM
How do I do this then?!?!
Can you guys just give the code to me, fixed and everything? I learn better that way, I always say that.


ATR'er since 2013.
Report Abuse
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
27 Feb 2017 04:59 PM
http://wiki.roblox.com/index.php?title=API:Class/PlayerGui
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