|
| 22 Jun 2012 08:46 AM |
game.Lighting.Map1:clone() --Change M1 to the name of the first model in lighting game.Lighting.Map2:clone() --Change M2 to the name of the second model in lighting game.Lighting.Map3:clone() --Change M3 to the name of the third model in lighting
glm1 = game.Lighting.Map1 --Change M1 to the name of the first model in lighting glm2 = game.Lighting.Map2 --Change M2 to the name of the second model in lighting glm3 = game.Lighting.Map3 --Change M3 to the name of the third model in lighting
game.Players.PlayerAdded:wait()
while true do v = math.random (1,3) --Change (1,3) to (1,4) for four disasters, to (1,5) for five Ect...
wait(1)
mnm = Instance.new("Message") mnm.Parent = game.Workspace mnm.Text = "Round Starting.. 15 Seconds Left" wait(5) mnm:Remove() H = Instance.new("Hint") H.Parent = game.Workspace H.Text = "10" wait(1) H.Text = "9" wait(1) H.Text = "8" wait(1) H.Text = "7" wait(1) H.Text = "6" wait(1) H.Text = "5" wait(1) H.Text = "4" wait(1) H.Text = "3" wait(1) H.Text = "2" wait(1) H.Text = "1" wait(1) H:Remove()
if (v == 1) then local m = Instance.new("Message") m.Parent = game.Workspace m.Text = "Round 1" d1 = glm1:clone() d1.Parent = game.Workspace wait(1) m:Remove() wait(1200) d1:Remove() local mmm = Instance.new("Message") mmm.Parent = game.Workspace mmm.Text = "Round 1 Over" wait(3) mmm.Text = "Next Round Loading.." wait(2) mmm:Remove() wait(5)
else if (v == 2) then local m2 = Instance.new("Message") m2.Parent = game.Workspace m2.Text = "Round 2" d2 = glm2:clone() d2.Parent = game.Workspace wait(1) m2:Remove() wait(1200) d2:Remove() local mmm = Instance.new("Message") mmm.Parent = game.Workspace mmm.Text = "Round 2 Over" wait(3) mmm.Text = "Next Round Loading.." wait(2) mmm:Remove() wait(5)
else local m3 = Instance.new("Message") m3.Parent = game.Workspace m3.Text = "Round 3" d3 = glm3:clone() d3.Parent = game.Workspace wait(1) m3:Remove() wait(1200) d3:Remove() local mmm = Instance.new("Message") mmm.Parent = game.Workspace mmm.Text = "Round 3 Over" wait(3) mmm.Text = "Next Round Loading.." wait(2) mmm:Remove() wait(5)
end end end
------------------------------ also:
while true do wait (1227) local players = game.Players:children() for i = 1, #players do if (players[i]:findFirstChild("leaderstats") ~= nil) and (players[i].leaderstats.Owns ~= nil) then players[i].leaderstats.Owns.Value = 0 end if (players[i]:findFirstChild("leaderstats") ~= nil) and (players[i].leaderstats.Pwns ~= nil) then players[i].leaderstats.Pwns.Value = 0 end if (players[i]:findFirstChild("leaderstats") ~= nil) and (players[i].leaderstats.Spree ~= nil) then players[i].leaderstats.Spree.Value = 0 end end end
-----------------------
Just making sure I'm doing this correctly. In the first script, do I put the model name inside the parenthesis? For the Remover script, why is the wait time 1227 seconds? I will adjust the leaderstats (Owns, Pwns, Spree) to what I'm going to have.
So far does this look good? |
|
|
| Report Abuse |
|
|
| |
|
|
| 22 Jun 2012 09:01 AM |
What I would do the message script:
H = Instance.new("Hint", Workspace) for i = 10, 1, -1 do print(i) H.Text = i wait(1) end
It's just more effiecient |
|
|
| Report Abuse |
|
|
|
| 22 Jun 2012 09:04 AM |
Thanks.
How does everything else look, and could you answer my other questions? |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 22 Jun 2012 09:52 AM |
This is really inefficient. . . .
There are so many things to say I can't even start :/ |
|
|
| Report Abuse |
|
|
| |
|
|
| 22 Jun 2012 10:00 AM |
| I've wanted a working rounds script for a while |
|
|
| Report Abuse |
|
|
|
| 22 Jun 2012 10:09 AM |
With the math.rand(1,3) thing, I would redesign it. First Off, just put all the Maps in a Model, named "Maps" Then parent that model into Lighting.
AllMaps = game.Lighting.Maps:getChildren() -- Get a table roundTime = 30 -- Time in sec for each round while true do mseg = Instance.new("Message", Workspace) mseg.Text = "A new round will begin in 15 seconds" wait(2) mseg:Destroy() wait(3) H = Instance.new("Hint", Workspace) for i = 10, 1, -1 do print(i) H.Text = i wait(1) end
chosenMap = AllMaps[math.random(1, #AllMaps)] NewMap = chosenMap:clone() NewMap.Parent = Workspace mseg = Instance.new("Message", Workspace) mseg.Text = "Round chosen:"..NewMap.Name wait(2) mseg.Text = "BEGIN IN THE ROUND!" wait(2) mseg:Destroy() wait(roundTime) end |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 22 Jun 2012 10:13 AM |
Fine.
game.Lighting.Map1:clone() --Change M1 to the name of the first model in lighting game.Lighting.Map2:clone() --Change M2 to the name of the second model in lighting game.Lighting.Map3:clone() --Change M3 to the name of the third model in lighting
glm1 = game.Lighting.Map1 --Change M1 to the name of the first model in lighting glm2 = game.Lighting.Map2 --Change M2 to the name of the second model in lighting glm3 = game.Lighting.Map3 --Change M3 to the name of the third model in lighting --Waste of variables. You could of called them later and make them local.
game.Players.PlayerAdded:wait() --Why use a playeradded event? You're saying to run everytime a player comes. . . Useless. You should use the NumPlayers to check if there's at least one player on. while true do --You can change the condition to the NumPlayers I said. v = math.random (1,3) --Change (1,3) to (1,4) for four disasters, to (1,5) for five Ect...
wait(1)
mnm = Instance.new("Message") mnm.Parent = game.Workspace mnm.Text = "Round Starting.. 15 Seconds Left" wait(5) mnm:Remove()--Destroy would be better. H = Instance.new("Hint") H.Parent = game.Workspace --NEED A FOR LOOP HERE H.Text = "10" wait(1) H.Text = "9" wait(1) H.Text = "8" wait(1) H.Text = "7" wait(1) H.Text = "6" wait(1) H.Text = "5" wait(1) H.Text = "4" wait(1) H.Text = "3" wait(1) H.Text = "2" wait(1) H.Text = "1" wait(1) H:Remove()
if (v == 1) then local m = Instance.new("Message") m.Parent = game.Workspace m.Text = "Round 1" d1 = glm1:clone() d1.Parent = game.Workspace wait(1) m:Remove() wait(1200) --I just want to say. NOthing to do about being efficient but this is like half an hour long you know :P d1:Remove() local mmm = Instance.new("Message") mmm.Parent = game.Workspace mmm.Text = "Round 1 Over" wait(3) mmm.Text = "Next Round Loading.." wait(2) mmm:Remove() wait(5)
else if (v == 2) then --Just because it randomized to 2 doesn't mean it's round two. It can round 2 from the beginning and you say "Round 2" below. local m2 = Instance.new("Message") m2.Parent = game.Workspace m2.Text = "Round 2" d2 = glm2:clone() d2.Parent = game.Workspace wait(1) m2:Remove() wait(1200) d2:Remove() local mmm = Instance.new("Message") mmm.Parent = game.Workspace mmm.Text = "Round 2 Over" wait(3) mmm.Text = "Next Round Loading.." wait(2) mmm:Remove() wait(5)
else -- I would still check just in case. local m3 = Instance.new("Message") m3.Parent = game.Workspace m3.Text = "Round 3" d3 = glm3:clone() d3.Parent = game.Workspace wait(1) m3:Remove() wait(1200) d3:Remove() local mmm = Instance.new("Message") mmm.Parent = game.Workspace mmm.Text = "Round 3 Over" wait(3) mmm.Text = "Next Round Loading.." wait(2) mmm:Remove() wait(5)
end end end
|
|
|
| Report Abuse |
|
|
|
| 22 Jun 2012 10:15 AM |
| @Miz, I think mine is a lot simpler and more efficient, and can happen an unlimited amount of times :D |
|
|
| Report Abuse |
|
|
|
| 22 Jun 2012 10:16 AM |
What is the Get a table? Aside from that, everything else I understand.
It doesn't reset KOs or WOs though, correct? Or could I just use the script that I posted for that?
Also, here was what I was planning on using it for:
- Having a gun fight type of game - Players fight on a map, after x seconds, this script runs - All players die - All players spawn on the new map - New round begins - Repeat
However, I also wanted all player's KOs and WOs to reset. I was going to add in some number of KOs achievement badge. |
|
|
| Report Abuse |
|
|
|
| 22 Jun 2012 10:29 AM |
| Give me a sec, building the script... |
|
|
| Report Abuse |
|
|
|
| 22 Jun 2012 10:31 AM |
| I actually just finished mine last week. It still has things to fix.... |
|
|
| Report Abuse |
|
|
| |
|
|
| 22 Jun 2012 10:38 AM |
| Ok, I'm finding the winner... |
|
|
| Report Abuse |
|
|
| |
|
|
| 22 Jun 2012 11:02 AM |
Have Miz fix my metatables but here goes:
StatTable = {} AllMaps = game.Lighting.Maps:getChildren() -- Get a table roundTime = 30 -- Time in sec for each round while true do mseg = Instance.new("Message", Workspace) mseg.Text = "A new round will begin in 15 seconds" wait(2) mseg:Destroy() H = Instance.new("Hint", Workspace) for i = 10, 0, -1 do print(i) H.Text = i wait(1) end
chosenMap = AllMaps[math.random(1, #AllMaps)] NewMap = chosenMap:clone() NewMap.Parent = Workspace mseg = Instance.new("Message", Workspace) mseg.Text = "Round chosen:"..NewMap.Name wait(2) mseg.Text = "BEGIN IN THE ROUND!"
--Next Part teles the players to the map, make an invisible point named telepoint in the map.
for i,v in pairs(game.Players:getPlayers()) do if v~= nil and v.Character~=nil then v.Character.Torso.CFrame = NewMap.TelePoint.CFrame +Vector3.new(5,5,5) end end
wait(2) mseg:Destroy() wait(roundTime)
--Kill players etc for i,v in pairs(game.Players:getPlayers()) do if v~= nil and v.Character~=nil then KillStat = v["leaderstats"]["Kills"] --FFC Method NameTable[i] = v.Name KillTable[i] = KillStat.Value Names = setmetatable(NameTable, KillTable) end end
for p = 1, #NameTable do if p ~= 1 then if getmetatable(Names[p]) > getmetatable(Names[p-1]) then leader = getmetatable(Names[p]) end end end
mseg = Instance.new("Message", Workspace) mseg.Text = "ROUND OVER! The player with the highest kills is:".. leader for i,v in pairs(game.Players:getPlayers()) do if v~= nil and v.Character~=nil then v.Character["Humanoid"].Health = 0 v["leaderstats"]["Kills"].Value = 0 v["leaderstats"]["Deaths"].Value = 0 end end end |
|
|
| Report Abuse |
|
|
|
| 22 Jun 2012 11:05 AM |
Wait, silly me forgot to clear the name and kill tables
StatTable = {} AllMaps = game.Lighting.Maps:getChildren() -- Get a table roundTime = 30 -- Time in sec for each round KillTable = {} NameTable = {} Names = nil while true do mseg = Instance.new("Message", Workspace) mseg.Text = "A new round will begin in 15 seconds" wait(2) mseg:Destroy() H = Instance.new("Hint", Workspace) for i = 10, 0, -1 do print(i) H.Text = i wait(1) end
chosenMap = AllMaps[math.random(1, #AllMaps)] NewMap = chosenMap:clone() NewMap.Parent = Workspace mseg = Instance.new("Message", Workspace) mseg.Text = "Round chosen:"..NewMap.Name wait(2) mseg.Text = "BEGIN IN THE ROUND!"
--Next Part teles the players to the map, make an invisible point named telepoint in the map.
for i,v in pairs(game.Players:getPlayers()) do if v~= nil and v.Character~=nil then v.Character.Torso.CFrame = NewMap.TelePoint.CFrame +Vector3.new(5,5,5) end end
wait(2) mseg:Destroy() wait(roundTime)
--Kill players etc for i,v in pairs(game.Players:getPlayers()) do if v~= nil and v.Character~=nil then KillStat = v["leaderstats"]["Kills"] --FFC Method NameTable[i] = v.Name KillTable[i] = KillStat.Value Names = setmetatable(NameTable, KillTable) end end
for p = 1, #NameTable do if p ~= 1 then if getmetatable(Names[p]) > getmetatable(Names[p-1]) then leader = getmetatable(Names[p]) end end end
mseg = Instance.new("Message", Workspace) mseg.Text = "ROUND OVER! The player with the highest kills is:".. leader for i,v in pairs(game.Players:getPlayers()) do if v~= nil and v.Character~=nil then v.Character["Humanoid"].Health = 0 v["leaderstats"]["Kills"].Value = 0 v["leaderstats"]["Deaths"].Value = 0 KillTable = {} NameTable = {} Names = nil end end end |
|
|
| Report Abuse |
|
|
|
| 22 Jun 2012 11:08 AM |
Whoa, thanks. Does "teleport" have to be an actual teleport or just name it that? |
|
|
| Report Abuse |
|
|
|
| 22 Jun 2012 11:13 AM |
Just make a brick and name it telepoint, oops need to change it a bit... Sorry for all the reposts, just realized the players would teleport into the bricks...
StatTable = {} AllMaps = game.Lighting.Maps:getChildren() -- Get a table roundTime = 30 -- Time in sec for each round KillTable = {} NameTable = {} Names = nil while true do mseg = Instance.new("Message", Workspace) mseg.Text = "A new round will begin in 15 seconds" wait(2) mseg:Destroy() H = Instance.new("Hint", Workspace) for i = 10, 0, -1 do print(i) H.Text = i wait(1) end
chosenMap = AllMaps[math.random(1, #AllMaps)] NewMap = chosenMap:clone() NewMap.Parent = Workspace mseg = Instance.new("Message", Workspace) mseg.Text = "Round chosen:"..NewMap.Name wait(2) mseg.Text = "BEGIN IN THE ROUND!"
--Next Part teles the players to the map, make an invisible point named telepoint in the map.
for i,v in pairs(game.Players:getPlayers()) do if v~= nil and v.Character~=nil then v.Character.Torso.CFrame = NewMap.TelePoint.CFrame +Vector3.new(math.random(1,5),5,math.random(1,5)) end end
wait(2) mseg:Destroy() wait(roundTime)
--Kill players etc for i,v in pairs(game.Players:getPlayers()) do if v~= nil and v.Character~=nil then KillStat = v["leaderstats"]["Kills"] --FFC Method NameTable[i] = v.Name KillTable[i] = KillStat.Value Names = setmetatable(NameTable, KillTable) end end
for p = 1, #NameTable do if p ~= 1 then if getmetatable(Names[p]) > getmetatable(Names[p-1]) then leader = getmetatable(Names[p]) end end end
mseg = Instance.new("Message", Workspace) mseg.Text = "ROUND OVER! The player with the highest kills is:".. leader for i,v in pairs(game.Players:getPlayers()) do if v~= nil and v.Character~=nil then v.Character["Humanoid"].Health = 0 v["leaderstats"]["Kills"].Value = 0 v["leaderstats"]["Deaths"].Value = 0 KillTable = {} NameTable = {} Names = nil end end end |
|
|
| Report Abuse |
|
|