of     1   

Kipyko
#141225373Wednesday, July 23, 2014 1:43 AM GMT

Thing is When I run this function in my script no errors pop up. So I don't know whats wrong, But what this function is suppose to do is it checks the InGame Value of all players in the game every second and if the value = false then the count = count + 1 and if the value = to true then the count = count -1 and once the value of count = 0 the game timer = 0 so the game ends. the problem with it though is its not changing the value of count (within the intValue NumEnd of workspace) so when this function does it's usual check every second at this area later on in the script, It sees the value is still at 0 so the game ends even though it shouldn't be ending. (Note: I think the problem is with the counting of the value of InGame but im not to sure what im doing wrong) please help me if you can. If you do not know what I'm saying Please DON'T reply to this thread. --------------------------------------------------------------------------------- count = game.Workspace.NumEnd.Value --------------------------------------------------------------------------------- while timer.Value > 0 do timer.Value = timer.Value - 1 h.Text = "TimeLeft: " .. timer.Value EndGame() wait(1) end -------------------------------------------------------------------------------- function EndGame() local count = 0 for i, v in pairs(game.Players:GetPlayers()) do StillAlive = v:FindFirstChild("InGame") if StillAlive then do if StillAlive == false then count = count + 1 else if StillAlive == true then count = count - 1 end end end end end print("Counting") if count <= 1 then timer.Value = 0 elseif count > 1 then print("Testing") end end
Kipyko
#141228255Wednesday, July 23, 2014 2:12 AM GMT

.
Reiyuss
#141230896Wednesday, July 23, 2014 2:39 AM GMT

O_O
BothAngles
#141231163Wednesday, July 23, 2014 2:42 AM GMT

--------------------------------------------------------------------------------- count = game.Workspace.NumEnd.Value --------------------------------------------------------------------------------- while timer.Value > 0 do timer.Value = timer.Value - 1 h.Text = "TimeLeft: " .. timer.Value EndGame() wait(1) end -------------------------------------------------------------------------------- function EndGame() local count = 0 for i, v in pairs(game.Players:GetPlayers()) do StillAlive = v:FindFirstChild("InGame");Spawn(wait) if StillAlive then do if StillAlive == false then count = count + 1 else if StillAlive == true then count = count - 1 end end end end end print("Counting") if count <= 1 then timer.Value = 0 elseif count > 1 then print("Testing") end end
Kodran
#141231470Wednesday, July 23, 2014 2:45 AM GMT

I'm not 100% sure but you probably want to do v.Character:FindFirstChild("InGame")
Kipyko
#141232909Wednesday, July 23, 2014 3:00 AM GMT

Thank you for the help <3 both of you :3 sadly its still not working T_T but thank you either way <3
Kipyko
#141235913Wednesday, July 23, 2014 3:30 AM GMT

(>O_O)>
Kipyko
#141237573Wednesday, July 23, 2014 3:46 AM GMT

.
Kodran
#141239090Wednesday, July 23, 2014 4:01 AM GMT

So since count is staying at 0, that means StillAlive is neither true nor false leaving only 1 explanation; it is nil. What script are you creating StillAlive in?
Kipyko
#141240759Wednesday, July 23, 2014 4:18 AM GMT

game.Players.PlayerAdded:connect(function(player) stats = Instance.new("IntValue", player) stats.Name = "leaderstats" points = Instance.new("IntValue", stats) points.Name = "Points" ingame = Instance.new("BoolValue", player) ingame.Name = "InGame" end) just a simple leaderboard script InGame is = to StillAlive. I know my InGame value is working if it wasnt some of my other scripts wouldn't be working I just dont know why it isn't counting there must be something wrong with my function that I cant see. but thank you for trying to help me out though <3
Kodran
#141241418Wednesday, July 23, 2014 4:25 AM GMT

Mind doing a print if StillAlive == nil? I love programming and I'm making an app but my artist's computer died so he can't do anything so I don't have any new art to add to the game, so I thought I'd come here and try to help some people out as best I could.
Kipyko
#141242625Wednesday, July 23, 2014 4:38 AM GMT

Oh that sounds really cool :3 I hope your game becomes a hit :D but im not sure what you mean by print StillAlive == Nil I'm sorta still a novice scripter even though some people think different with some of the codes I do XD. I mostly just been teaching myself :3. I wish I had your scripting knowledge so I could also help people out but sadly its still in development XD :P.
Kipyko
#141243640Wednesday, July 23, 2014 4:48 AM GMT

ohhh stupid me now i know what you mean by print if stillalive == nil im very dumb at some moments XD
Kodran
#141243767Wednesday, July 23, 2014 4:50 AM GMT

It's great that you're learning programming and thanks :D Sorry I was kind of vague I mean print something random like "hi" if StillAlive == nil so if it says hi in the output you know stillalive is nil.
Kipyko
#141244174Wednesday, July 23, 2014 4:54 AM GMT

I did a print and its not showing up a nil value within my output. I'm even more confused on why it isn't working XD.
Kodran
#141244814Wednesday, July 23, 2014 5:01 AM GMT

It's 1 AM here but now you have my curiosity and I am determined to fix this problem for you lol. is the timer going down?
Kipyko
#141244825Wednesday, July 23, 2014 5:01 AM GMT

now I'm even more sure its something to do with this part of my script but I'm not so sure what I did wrong hmmmmm. ----------------------------------------------------------------------- function EndGame() local count = 0 for i, v in pairs(game.Players:GetPlayers()) do StillAlive = v:FindFirstChild("InGame") if StillAlive then do if StillAlive == false then count = count + 1 else if StillAlive == true then count = count - 1 -----------------------------------------------------------------------
Kipyko
#141245235Wednesday, July 23, 2014 5:05 AM GMT

lol your 3 hours in the future for me :O anyways yeah I did a test with the script for the print("Counting") if count > 1 then timer.Value = 0 elseif count <= 1 then print("Testing") i just switched the values on it to see if the Print would help me out more and it did so I see the words counting and testing every second for 60 seconds in my output :3
Kodran
#141245318Wednesday, July 23, 2014 5:05 AM GMT

Honestly the only thing I can think of is a silly mistake such as setting the timer value to 0 by default or something.
Kipyko
#141245668Wednesday, July 23, 2014 5:09 AM GMT

oh no worries i made quadruple sure that it wasn't set at 0 i got worried sometimes that it was the source but sadly it wasn't XD.
Kodran
#141246385Wednesday, July 23, 2014 5:17 AM GMT

OHH! okay, you set count to 0 then you add 1 because stillalive is false(cause it is by default) and then it's equal to less than or equal to 1(cause it is 1) then, it sets timer to 0 and never checks again. I'm going to bed I hope that was right!
Kipyko
#141248606Wednesday, July 23, 2014 5:41 AM GMT

yeah thats correct :3
Reiyuss
#141309327Wednesday, July 23, 2014 9:18 PM GMT

O_O
Kipyko
#141317738Wednesday, July 23, 2014 10:43 PM GMT

?

    of     1