Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I do this?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

I wanted to know how to make a part of a script where if all the players died then the round ends and resets the timer back to zero.

Round Code:

1function roundCountdown()
2    for roundMinute = 2,0,-1 do
3        for roundSecond = 59,0,-1 do
4            playerNotification('Time left!')
5            playerCountdown(string.format("%d:%.2d",roundMinute,roundSecond))
6            wait(1)
7        end
8    end
9end

1 answer

Log in to vote
0
Answered by
xApRix 25
9 years ago
01game.Players.PlayerAdded:connect(function(Player)
02    Player.CharacterAdded:connect(function()
03        local GameValue = Instance.new("BoolValue")
04        GameValue.Parent = Player.Character
05        GameValue.Name = "InGameValue"
06    end)
07end)
08 
09--The above adds in the "InGameValue" value every time the player spawns.
10 
11 
12function CheckPlayers()
13    local InGameNum = 0 --The number of players in game
14    for _,v in pairs(game.Players:GetChildren())do --Scroll through players
15        local Character = v.Character
View all 51 lines...

This code goes after you teleport the players:

1--Assuming you already have the player under "game.players".
2local PlayerInGameValue = player.Character.FindFirstChild("InGameValue")
3if PlayerInGameValue  then
4    PlayerInGameValue.Value = true
5else
6    print("Can not find: 'InGameValue'")
7end

This should work, it does require you to set the value of "InGameValue" located in the player's character to true when you place him in a round though.

0
It doesn't seem to work at all. It just skips to the end of the round once it round even starts. I was wondering how I could use it with IntValues. For example, if everybody's 'Playing' value is equal to zero then it ends the round. Vestralix 15 — 9y
0
Just edited it, It should work now. Remember to set the value of "InGameValue" to true when the players enter a round/minigame. xApRix 25 — 9y
0
Still not working, it does the same thing as before. Vestralix 15 — 9y
0
Did you set the "InGameValue" to true when the players entered a round? xApRix 25 — 9y
Ad

Answer this question