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: Why does this not change to true?

Previous Thread :: Next Thread 
xLink123 is not online. xLink123
Joined: 07 Aug 2014
Total Posts: 11158
16 May 2015 10:00 PM
game.Players.PlayerAdded:connect(function(player)
local bool = Instance.new("BoolValue", player)
bool.Name = "Alive"
if player.Character then
StartGame()
end
end)

function ResetGame()
for i, v in pairs(game.Players:GetChildren()) do
v:LoadCharacter()
end
game.Workspace.Disaster = ""
LivingPlayers = {}
end

function StartGame()
for i, v in pairs(game.Players:GetPlayers()) do
local val = v:FindFirstChild("Alive")
val.Value = true
end
end



the player added function should call the StartGame() function right? and it should then change the Alive value to true?
Report Abuse
xLink123 is not online. xLink123
Joined: 07 Aug 2014
Total Posts: 11158
16 May 2015 10:01 PM
ignore the ResetGame() function

Report Abuse
Klink45 is not online. Klink45
Joined: 06 Jun 2011
Total Posts: 26054
16 May 2015 10:09 PM
Does the value exist?
Report Abuse
xLink123 is not online. xLink123
Joined: 07 Aug 2014
Total Posts: 11158
16 May 2015 10:12 PM
yes
Report Abuse
Klink45 is not online. Klink45
Joined: 06 Jun 2011
Total Posts: 26054
16 May 2015 10:12 PM
Hmmm... What does the output say?
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
16 May 2015 10:13 PM
It should, but it won't; unless the character spawns instantaneously.

game.Players.PlayerAdded:connect(function(player)
local bool = Instance.new("BoolValue", player)
bool.Name = "Alive"
player.CharacterAdded:wait()
StartGame()
end)
Report Abuse
vacha is not online. vacha
Joined: 06 Jan 2011
Total Posts: 1993
16 May 2015 10:17 PM
Why not create a table of all the players and remove them from the list as they die?


while true do the do
Report Abuse
xLink123 is not online. xLink123
Joined: 07 Aug 2014
Total Posts: 11158
16 May 2015 10:23 PM
I was doing that earlier, but then someone told me this way would be better..
Report Abuse
Klink45 is not online. Klink45
Joined: 06 Jun 2011
Total Posts: 26054
16 May 2015 10:25 PM
Well, I think vacha's way is actually better. It might work that way...
Report Abuse
vacha is not online. vacha
Joined: 06 Jan 2011
Total Posts: 1993
16 May 2015 10:26 PM
if val then --Runs if it finds "val"
val.Value = true
else --Creates a new value if doesn't find "val"
local val = Instance.new("BoolValue",player)
val.Value = true
end



while true do the do
Report Abuse
xLink123 is not online. xLink123
Joined: 07 Aug 2014
Total Posts: 11158
16 May 2015 10:31 PM
I do think a script that has a table with players in it is easier,

I can picture bugs already with the other way
Report Abuse
vacha is not online. vacha
Joined: 06 Jan 2011
Total Posts: 1993
16 May 2015 10:32 PM
Yeah, if you encounter any glitches or need help post them here :D
gl


while true do the do
Report Abuse
xLink123 is not online. xLink123
Joined: 07 Aug 2014
Total Posts: 11158
16 May 2015 10:34 PM
Thank you, I am making a hunger games with some of my friends in my computer class and I'm in charge of coding it..

I will be sure to post here if I have troubles ty
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