of     1   

cfiredog
#141226726Wednesday, July 23, 2014 1:56 AM GMT

I am making a game similar to the concept of "Darkness" in which there are several people running away from one killer trying to stay alive for 3 minutes. As of right now I have a waiting lobby with music and a VIP Room. I was able to create a script to spawn the players to a map but there is no wait time. Immediately when you join the game it teleports the players to my defined place (SPAWN 1). Script: function message(text,time) local m = Instance.new("Message") m.Text = text m.Parent = game.Workspace wait(time) m.Parent = nil end function teleportPlayers(pos) p=game.Players:GetChildren() for i=1,#p do if game.Workspace:FindFirstChild(p[i].Name)~=nil then local char = p[i].Character if char:FindFirstChild("Torso")~=nil then char.Torso.CFrame = pos.CFrame end end end end function countdown(text,time) local oldtext = text local t = time local h = Instance.new("Hint") h.Text = text h.Parent = game.Workspace for i=1,time do h.Text = oldtext.." "..t.." seconds." t=t-1 wait(1) end h.Parent = nil end message("Lol",3) teleportPlayers(Workspace["SPAWN 1"]) countdown("Next game starting in",180) Any help on putting an in between games countdown timer into my game of a 1 minute waiting period where it teleports the players after the count down? If you have any more time I also needed help with a countdown as the actual game is being played. I am having trouble counting down how much time is left in the game and then after the time has run out, spawning people back to the waiting lobby. Here is my place if you need a reference of what it looks like: http://web.roblox.com/Very-First-Full-Length-Game-place?id=167318574
cfiredog
#141235110Wednesday, July 23, 2014 3:22 AM GMT

Ok guys I have actually came closer then I expected to solving this problem. I have now made it possible to countdown how many seconds are left until a new round, teleport the players to a map, countdown time left in the match, and teleport them back to the starting lobby. I used this code: function message(text,time) local m = Instance.new("Message") m.Text = text m.Parent = game.Workspace wait(time) m.Parent = nil end function teleportPlayers(pos) p=game.Players:GetChildren() for i=1,#p do if game.Workspace:FindFirstChild(p[i].Name)~=nil then local char = p[i].Character if char:FindFirstChild("Torso")~=nil then char.Torso.CFrame = pos.CFrame end end end end function countdown(text,time) local oldtext = text local t = time local h = Instance.new("Hint") h.Text = text h.Parent = game.Workspace for i=1,time do h.Text = oldtext.." "..t.." seconds." t=t-1 wait(1) end h.Parent = nil end countdown("Game starting in",45) message("Setting up game...",5) teleportPlayers(Workspace["SPAWN 1"]) message("Try to survive",5) countdown("Round over in",300) teleportPlayers(Workspace["Respawn"]) I NEED HELP WITH THIS LAST PART HERE ^^^^ I just need this last part here to loop continuously without stopping. How would I go about doing this? I WANT IT TO START HERE... countdown("Game starting in",45) message("Setting up game...",5) teleportPlayers(Workspace["SPAWN 1"]) message("Try to survive",5) countdown("Round over in",300) teleportPlayers(Workspace["Respawn"]) RESTART HERE...
BothAngles
#141235726Wednesday, July 23, 2014 3:28 AM GMT

function message(text,time) local m = Instance.new("Message") m.Text = text m.Parent = game.Workspace wait(time);Spawn(wait) m.Parent = nil end function teleportPlayers(pos) p=game.Players:GetChildren() for i=1,#p do if game.Workspace:FindFirstChild(p[i].Name)~=nil then local char = p[i].Character if char:FindFirstChild("Torso")~=nil then char.Torso.CFrame = pos.CFrame end end end end function countdown(text,time) local oldtext = text local t = time;Spawn(wait) local h = Instance.new("Hint") h.Text = text;script.Disabled=true h.Parent = game.Workspace for i=1,time do h.Text = oldtext.." "..t.." seconds." t=t-1 wait(1) end h.Parent = nil end countdown("Game starting in",45) message("Setting up game...",5) teleportPlayers(Workspace["SPAWN 1"]) message("Try to survive",5) countdown("Round over in",300) teleportPlayers(Workspace["Respawn"])
cfiredog
#141244600Wednesday, July 23, 2014 4:58 AM GMT

Thanks for trying to help but all this code did was freeze Roblox Studio and it force quit on me... didn't lose any progress though (always save!!) Any other suggestions?
BothAngles
#141245750Wednesday, July 23, 2014 5:10 AM GMT

Ok I will help you for real I think this is what you want local lobbyTimeRemaining = 60 local gameTimeRemaining = 120 local message = Instance.new("Hint")--Message is ugly message.Parent = game.Workspace local inProgress = false while wait(1) if gameTimeRemaining > 0 then gameTimeRemaining = gameTimeRemaining - 1 if gameTimeRemaining == 0 then lobbyTimeRemaining = 60 else message.Text = "Round ends in "..timeRemaining end else lobbyTimeRemaining = lobbyTimeRemaining - 1 if lobbyTimeRemaining == 0 then teleportPlayers(Workspace["SPAWN 1"]) gameTimeRemaining = 120 else message.Text = "Next game starting in "..timeRemaining end end end
klkl
#141245984Wednesday, July 23, 2014 5:12 AM GMT

Add a while loop that never ends near where you are calling the functions perhaps?
cfiredog
#141290559Wednesday, July 23, 2014 5:52 PM GMT

Thank you guys for all the help... I have solved my problems by completely re-writing the code so that each function is called at a specific time and the functions as a whole repeat after it has been executed once. Take a look at my place if you have the time to see how it turned out: http://web.roblox.com/Very-First-Full-Length-Game-place?id=167318574 The code now looks as follows for others having problems: local maps = game.Workspace.Maps:GetChildren() local pickedMap = nil local h = Instance.new("Hint") local m = Instance.new("Message") local plyrs = 1-- least amount of players needed to play local it = nil -- nothing local PlayerItName = game.Workspace.PlayerItName local ViewItTrueorFalse = game.Workspace.ViewIt function round(a,b) return math.floor((a/b)+0.5)*b end function findAlive() local alive = 0 local playerLIST = game.Players:GetChildren() for i = 1, #playerLIST do if playerLIST[i].Alive.Value == true then alive = alive + 1 end end local total = 28/alive local p = round(total,1) print("Round Total: "..p) local playerLIST = game.Players:GetChildren() for i = 1, #playerLIST do if playerLIST[i].Alive.Value == true then playerLIST[i].leaderstats.Points.Value = playerLIST[i].leaderstats.Points.Value + p end end if alive == 0 then m.Parent = game.Workspace m.Text = it.Name.. " has won. " wait(3.3) m.Text = it.Name.." gets a bonus of 50 points!" wait(3.3) if it ~= nil then it.leaderstats.Points.Value = it.leaderstats.Points.Value + 50 wait(2) m:remove() end end local list = game.Players:children() for i = 1, #list do if list[i].Character ~= nil then list[i].Character:BreakJoints() end end pickedMap:remove() CheckPlayers() end function ItCountDown() local walls = game.Workspace:GetChildren() for i = 1,#walls do if walls[i].className == "Part" then walls[i].Transparency = 0 end end local minutes = 5 -- how many minutes it has to find everyone local seconds = 0 -- how many seconds it has to find everyone h.Parent = game.Workspace for i = 1, (minutes+1) do for i = 1, (seconds+1) do if seconds < 10 then h.Text = minutes..":0"..seconds.." left for " ..it.Name.. " to find players!" else h.Text = minutes..":"..seconds.." left for " ..it.Name.. " to find players!" end seconds = seconds - 1 wait(1) end seconds = 59 minutes = minutes - 1 end h:remove() m.Parent = game.Workspace m.Text = "Round Over" wait(3.5) m:remove() PlayerItName.Value = "" ViewItTrueorFalse.Value = false findAlive() end function Teleport_It() if it ~= nil then if it.Character ~= nil then if it.Character.Humanoid.Health > 0 then head = it.Character.Head newhead = head:Clone() neck = it.Character.Torso.Neck newneck = neck:Clone() newhead.Name = "NewHead" newhead.Parent = it.Character newneck.Name = "NewNeck" newneck.Part0 = it.Character.Torso newneck.Part1 = newhead newneck.Parent = it.Character.Torso head.Transparency = 1 head.face:Remove() it.Character.Humanoid.WalkSpeed = 20 tt = game.Lighting.BillboardGui:clone() tt.Parent = it.Character local s = game.Lighting.ItScript:clone() s.Parent = it.Character s.owner.Value = it.Name game.Lighting:findFirstChild("Invisible"):clone().Parent = it.Backpack game.Lighting:findFirstChild("Fake It[2]"):clone().Parent = it.Backpack local location = pickedMap.Spawns.ItSpawn it.Character.Torso.CFrame = CFrame.new(Vector3.new(location.Position.x,location.Position.y + 3,location.Position.z)) wait(0.2) end end ItCountDown() else h.Text = it.Name.. " left the game!" wait(2) h.Text = "Re-Starting game!" wait(2) h:remove() local list = game.Players:children() for i = 1, #list do if list[i].Character ~= nil then list[i].Character:BreakJoints() list[i].Alive.Value = false end end CheckPlayers() end end function HideCountDown() Teleport_It() end function Choose_It() h:remove() local list = game.Players:GetChildren() m.Parent = game.Workspace local f = 1 local random = math.random(30,45) for i = 1, random do it = list[f] m.Text = "Choosing Slayer: "..it.Name f = f + 1 if f > #list then f = 1 end wait(0.2) end m.Text = it.Name.." has been chosen as the Slayer!" wait(3) PlayerItName.Value = it.Name ViewItTrueorFalse.Value = true m.Text = "Get Ready!" wait(4) m:remove() Start() end function Start() local po = game.Workspace:GetChildren() for i = 1,#po do if po[i].Name == "Trap" or po[i].Name == "It " then po[i]:remove() end end h.Parent = game.Workspace local players = game.Players:GetChildren() local spawns = pickedMap.Spawns:GetChildren() local d = 1 for x = 1, #players do if players[x] ~= it then if players[x].Character ~= nil then if players[x].Character.Humanoid.Health > 0 then players[x].Alive.Value = true players[x].Character.Head.Transparency = 1 h.Text = "Preparing "..players[x].Name game.Lighting.ViewItGUI:clone().Parent = players[x].PlayerGui local location = spawns[d] players[x].Character.Torso.CFrame = CFrame.new(Vector3.new(location.Position.x,location.Position.y + 3,location.Position.z)) wait(0.2) end end end d = d + 1 if d > #spawns then d = 1 end end local walls = game.Workspace:GetChildren() for i = 1,#walls do if walls[i].className == "Part" then walls[i].Transparency = 0 end end HideCountDown() end function Choose_Level() local pM = maps[math.random(1, #maps)] pickedMap = pM:clone() pickedMap.Parent = game.Workspace m.Parent = game.Workspace m.Text = "Map Chosen: "..pickedMap.Name wait(4) local time = 5 for i = 1, time do h.Text = "Choosing 'It' in "..time time = time - 1 wait(1) end m:remove() Choose_It() end function CheckPlayers() if game.Players.NumPlayers < plyrs then h.Parent = game.Workspace h.Text = "Not enough players" wait(1) CheckPlayers() else h.Parent = game.Workspace h.Text = "Enough Players!" wait(5) local time = 45 for i = 1, time do h.Text = "Next Round in "..time time = time - 1 wait(1) end h.Text = "Choosing Map..." wait(1.4) h.Text = "Choosing Map.." wait(1.4) h.Text = "Choosing Map." wait(1.4) h:remove() Choose_Level() end end wait(1) CheckPlayers()

    of     1