|
| 02 Feb 2014 02:27 PM |
| I need this chunk of code to check if anyone has died since the beginning of the script. And if they did, I want it to check for the last one standing. I want it to display their name at the end of the round. Please help! |
|
|
| Report Abuse |
|
|
Vuva
|
  |
| Joined: 22 Jan 2010 |
| Total Posts: 1102 |
|
|
| 02 Feb 2014 02:29 PM |
| Maybe when the round starts add all of the players in the round to a table, and when a player dies they get removed form the table (assuming you leave the round once you die) and then when the length of the table is 1 then the round would end. |
|
|
| Report Abuse |
|
|
|
| 02 Feb 2014 02:31 PM |
| What do you mean by table? Can you please script whatever you said please? |
|
|
| Report Abuse |
|
|
|
| 02 Feb 2014 02:32 PM |
| If you already have a script, we'll be glad to fix it. We're not making scripts for you. |
|
|
| Report Abuse |
|
|
| |
|
|
| 02 Feb 2014 02:37 PM |
Okay but it's not efficient. while true do wait(5) local msg = Instance.new("Hint") msg.Parent = game.Workspace game.Workspace.Click:Play() msg.Text = "Intermission (20)" wait(1) game.Workspace.Click:Play() msg.Text = "Intermission (19)" wait(1) game.Workspace.Click:Play() msg.Text = "Intermission (18)" wait(1) game.Workspace.Click:Play() msg.Text = "Intermission (17)" wait(1) game.Workspace.Click:Play() msg.Text = "Intermission (16)" wait(1) game.Workspace.Click:Play() msg.Text = "Intermission (15)" wait(1) game.Workspace.Click:Play() msg.Text = "Intermission (14)" wait(1) game.Workspace.Click:Play() msg.Text = "Intermission (13)" wait(1) game.Workspace.Click:Play() msg.Text = "Intermission (12)" wait(1) game.Workspace.Click:Play() msg.Text = "Intermission (11)" wait(1) game.Workspace.Click:Play() msg.Text = "Intermission (10)" wait(1) game.Workspace.Click:Play() msg.Text = "Intermission (9)" wait(1) game.Workspace.Click:Play() msg.Text = "Intermission (8)" wait(1) game.Workspace.Click:Play() msg.Text = "Intermission (7)" wait(1) game.Workspace.Click:Play() msg.Text = "Intermission (6)" wait(1) game.Workspace.Click:Play() msg.Text = "Intermission (5)" wait(1) game.Workspace.Click:Play() msg.Text = "Intermission (4)" wait(1) game.Workspace.Click:Play() msg.Text = "Intermission (3)" wait(1) game.Workspace.Click:Play() msg.Text = "Intermission (2)" wait(1) game.Workspace.Click:Play() msg.Text = "Intermission (1)" wait(1) game.Workspace.Click:Play() msg.Text = "Intermission (0)" wait(1) game.Workspace.int:Play() msg.Text = "Welcome to Sword Battle!" wait (3) msg.Text = "The objective of this game is to battle all of your opponents and become the lone victor." wait(5) msg.Text = "Now selecting a random map..." local mapDirectory = game.Lighting.Maps local maps = mapDirectory:getChildren() local pickedMap = maps[math.random(1, #maps)] local pickedMapClone = pickedMap:clone() pickedMapClone.Parent = game.Workspace wait(3) msg.Text = "The map is "..pickedMapClone.Name.."!" wait(3) msg.Text = "This round will be starting in..." wait (3) game.Workspace.Five:Play() msg.Text = "5" wait (1) game.Workspace.Four:Play() msg.Text = "4" wait (1) game.Workspace.Three:Play() msg.Text = "3" wait (1) game.Workspace.Two:Play() msg.Text = "2" wait (1) game.Workspace.One:Play() msg.Text = "1" wait (1) game.Workspace.Begin:Play() msg.Text = "BEGIN!" game.Workspace.int:Stop() game.Workspace.music:Play() local p = game.Players:GetChildren() for i = 1, #p do p[i].Character:MoveTo(Vector3.new(391.7, 638.5, -322.7)) msg:remove() end
game.Workspace.music.Looped = false
local swordModel = game:GetService("InsertService"):LoadAsset(125013769) local sword = swordModel:GetChildren()[1]
for _, player in pairs(game.Players:GetPlayers()) do sword:Clone().Parent = player.Backpack end
local m = Instance.new("Hint") m.Parent = game.Workspace m.Text = "Game ends in 60" wait(1) m.Text = "Game ends in 59" wait(1) m.Text = "Game ends in 58" wait(1) m.Text = "Game ends in 57" wait(1) m.Text = "Game ends in 56" wait(1) m.Text = "Game ends in 55" wait(1) m.Text = "Game ends in 54" wait(1) m.Text = "Game ends in 53" wait(1) m.Text = "Game ends in 52" wait(1) m.Text = "Game ends in 51" wait(1) m.Text = "Game ends in 50" wait(1) m.Text = "Game ends in 49" wait(1) m.Text = "Game ends in 48" wait(1) m.Text = "Game ends in 47" wait(1) m.Text = "Game ends in 46" wait(1) m.Text = "Game ends in 45" wait(1) m.Text = "Game ends in 44" wait(1) m.Text = "Game ends in 43" wait(1) m.Text = "Game ends in 42" wait(1) m.Text = "Game ends in 41" wait(1) m.Text = "Game ends in 40" wait(1) m.Text = "Game ends in 39" wait(1) m.Text = "Game ends in 38" wait(1) m.Text = "Game ends in 37" wait(1) m.Text = "Game ends in 36" wait(1) m.Text = "Game ends in 35" wait(1) m.Text = "Game ends in 34" wait(1) m.Text = "Game ends in 33" wait(1) m.Text = "Game ends in 32" wait(1) m.Text = "Game ends in 31" wait(1) m.Text = "Game ends in 30" wait(1) m.Text = "Game ends in 29" wait(1) m.Text = "Game ends in 28" wait(1) m.Text = "Game ends in 27" wait(1) m.Text = "Game ends in 26" wait(1) m.Text = "Game ends in 25" wait(1) m.Text = "Game ends in 24" wait(1) m.Text = "Game ends in 23" wait(1) m.Text = "Game ends in 22" wait(1) m.Text = "Game ends in 21" wait(1) m.Text = "Game ends in 20" wait(1) m.Text = "Game ends in 19" wait(1) m.Text = "Game ends in 18" wait(1) m.Text = "Game ends in 17" wait(1) m.Text = "Game ends in 16" wait(1) m.Text = "Game ends in 15" wait(1) m.Text = "Game ends in 14" wait(1) m.Text = "Game ends in 13" wait(1) m.Text = "Game ends in 12" wait(1) m.Text = "Game ends in 11" wait(1) m.Text = "Game ends in 10" wait(1) m.Text = "Game ends in 9" wait(1) m.Text = "Game ends in 8" wait(1) m.Text = "Game ends in 7" wait(1) m.Text = "Game ends in 6" wait(1) game.Workspace.Five:Play() m.Text = "Game ends in 5" wait(1) game.Workspace.Four:Play() m.Text = "Game ends in 4" wait(1) game.Workspace.Three:Play() m.Text = "Game ends in 3" wait(1) game.Workspace.Two:Play() m.Text = "Game ends in 2" wait(1) game.Workspace.One:Play() m.Text = "Game ends in 1" wait(1) m.Text = "Game Ended!" wait(1) game.Workspace.music:Stop() pickedMapClone:remove() game.Workspace.Message:Remove() local p = game.Players:GetChildren() for i = 1, #p do p[i].Character:MoveTo(Vector3.new(391.8, 669.9, -202.7)) end end |
|
|
| Report Abuse |
|
|
|
| 02 Feb 2014 02:39 PM |
| That has nothing to do with checking if a player died. You just gave the entire game's script which, by the way, is extremely inefficient. |
|
|
| Report Abuse |
|
|
Vuva
|
  |
| Joined: 22 Jan 2010 |
| Total Posts: 1102 |
|
|
| 02 Feb 2014 02:42 PM |
Erm yeah that's really inefficient ._. I would recommend doing simpler projects (or learning more lua) because if you keep going on with this one then you're going to have a hard time trying to fix/debug your code. |
|
|
| Report Abuse |
|
|
|
| 02 Feb 2014 02:43 PM |
Vuva Oh my god imagine when he's debugging via printing on each line |
|
|
| Report Abuse |
|
|
|
| 02 Feb 2014 09:03 PM |
Hey man, Ive taken you're code and made it a bit more efficent.
--Made by IAmThe0nly0ne for FallenTacoz
--Please report any errors to me, I don't have my own testing space readily avalibe so... local msg = Instance.new("Hint",Workspace) Intermission = 20 Play = 5 GameEnd = 60 PlayersNeededToStartGame = 1
function countdown() while wait(1) do GameEnd = GameEnd -1 msg.Text = "The Game Is Ending In"..GameEnd.." Seconds!" if GameEnd < 0 then msg.Text="The Game Has Ended!" game.Workspace.music:Stop() pickedMapClone:remove() game.Workspace.Message:Remove() local p = game.Players:GetChildren() for i = 1, #p do p[i].Character:MoveTo(Vector3.new(391.8, 669.9, -202.7)) end end end end
function intermission() while wait(1) do Intermission = Intermission -1 msg.Text = "Intermission"..Intermission.." Seconds Left" if Intermission < 0 then startgame() end end end
function begin() game.Workspace.Begin:Play() msg.Text = "BEGIN!" game.Workspace.int:Stop() game.Workspace.music:Play() local p = game.Players:GetChildren() for i = 1, #p do p[i].Character:MoveTo(Vector3.new(391.7, 638.5, -322.7)) msg:remove() countdown() end
game.Workspace.music.Looped = false
local swordModel = game:GetService("InsertService"):LoadAsset(125013769) local sword = swordModel:GetChildren()[1]
for _, player in pairs(game.Players:GetPlayers()) do sword:Clone().Parent = player.Backpack end
end
function startthegame() while wait(1) do Play = Play - 1 msg.Text = "Game Is Starting In"..Play.." Seconds!" if Play < 0 then begin() end end end
function startgame() game.Workspace.int:Play() msg.Text = "Welcome to Sword Battle!" wait (3) msg.Text = "The objective of this game is to battle all of your opponents and become the lone victor." wait(5) msg.Text = "Now selecting a random map..." local mapDirectory = game.Lighting.Maps local maps = mapDirectory:getChildren() local pickedMap = maps[math.random(1, #maps)] local pickedMapClone = pickedMap:clone() pickedMapClone.Parent = game.Workspace wait(3) msg.Text = "The map is "..pickedMapClone.Name.."!" wait(3) msg.Text = "This round will be starting in..." wait (3) startthegame() end
function checkplayers() if game.Players.NumPlayers == PlayersNeededToStartGame then startgame() end end checkplayers() --Taken from 254 Lines to 98 Lines of code by IAmThe0nly0ne |
|
|
| Report Abuse |
|
|
ash877
|
  |
| Joined: 18 Feb 2008 |
| Total Posts: 5142 |
|
|
| 02 Feb 2014 09:13 PM |
t={}---is a table
table.insert(t,player.Name) ---is how you put stuff in it :3 |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 02 Feb 2014 10:11 PM |
| ^Feeling generous much? or just feeling sad for him..? xD |
|
|
| Report Abuse |
|
|
|
| 03 Feb 2014 07:51 AM |
| Look, guys. I know my script is inefficient. I don't need you telling me that. This is a scripting help page, not a criticism page. So far, none of you guys helped me. |
|
|
| Report Abuse |
|
|
EcIiptic
|
  |
| Joined: 12 Aug 2009 |
| Total Posts: 13737 |
|
|
| 03 Feb 2014 10:26 AM |
String = "http://wiki.roblox.com/index.php/Loops" link = ""
link = String:sub(1,1) wait(1) print(link) link = String:sub(1,2) wait(1) print(link) link = String:sub(1,3) wait(1) print(link) link = String:sub(1,4) wait(1) print(link) link = String:sub(1,5) wait(1) print(link) link = String:sub(1,6) wait(1) print(link) link = String:sub(1,7) wait(1) print(link) link = String:sub(1,8) wait(1) print(link) link = String:sub(1,9) wait(1) print(link) link = String:sub(1,10) wait(1) print(link) link = String:sub(1,11) wait(1) print(link) link = String:sub(1,12) wait(1) print(link) link = String:sub(1,13) wait(1) print(link) link = String:sub(1,14) wait(1) print(link) link = String:sub(1,15) wait(1) print(link) link = String:sub(1,16) wait(1) print(link) link = String:sub(1,17) wait(1) print(link) link = String:sub(1,18) wait(1) print(link) link = String:sub(1,19) wait(1) print(link) link = String:sub(1,20) wait(1) print(link) link = String:sub(1,21) wait(1) print(link) link = String:sub(1,22) wait(1) print(link) link = String:sub(1,23) wait(1) print(link) link = String:sub(1,24) wait(1) print(link) link = String:sub(1,25) wait(1) print(link) link = String:sub(1,26) wait(1) print(link) link = String:sub(1,27) wait(1) print(link) link = String:sub(1,28) wait(1) print(link) link = String:sub(1,29) wait(1) print(link) link = String:sub(1,30) wait(1) print(link) link = String:sub(1,31) wait(1) print(link) link = String:sub(1,32) wait(1) print(link) link = String:sub(1,33) wait(1) print(link) link = String:sub(1,34) wait(1) print(link) link = String:sub(1,35) wait(1) print(link) link = String:sub(1,36) wait(1) print(link) link = String:sub(1,37) wait(1) print(link) link = String:sub(1,38) print(link)
there |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 03 Feb 2014 10:36 PM |
| Constructive critisism is a part of helping. It's about improving your own qualities. It furthers you in your education of lua instead of just telling you how to do it. |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 03 Feb 2014 11:03 PM |
ew so unefficent
do varisables
coroutine.new(coroutine.resume) a = a - 1
something.Text = "STarting in"..a |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 03 Feb 2014 11:09 PM |
I dunno do a .Died function and add to a table
score = {}
game.Players.PlayerAdded:connect(function(p) hum = p.Parent:FindFirstChild("Humanoid") hum.Died:connect(function() table.insert(score, p.Name) end) end)
then check it like this or something
if score[1] then print("Uh oh, someone lost")
Btw, im really not sure. I just made this quickly. No checking,
|
|
|
| Report Abuse |
|
|