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

How to get combine these two scripts?

Asked by 10 years ago

I don't want the second script to work unless everything in the first script is true. The first script is supposed to not start the game until there are at least more than one player in the server. I can't find a function to get the scripts to work together. First script is below and then second.


while true do wait(0) if game.Players.NumPlayers < 1 then if msg then msg:Remove() end msg = Instance.new("Message") msg.Parent = game.Workspace msg.Text = "Not enough players. Waiting for more players to join..."-- What the message will say elseif game.Players.NumPlayers > 1 then if msg then msg:Remove() end end end

Second script:



while true do h = Instance.new ("Message") p = game.Players:GetChildren() randplayer = p[math.random(#p)] --Chooses the random Laser King randplayer.TeamColor = BrickColor.new("Pastel violet") randplayer.Character:BreakJoints() m = Instance.new("Hint") m.Parent = workspace m.Text = randplayer.Name.." is the Target! " wait(3) m.Text = randplayer.Name.." Your health is now 300! " wait(3) m.Parent = nil h.Parent = workspace h.Text = "Assassins! you have 2 minutes to kill the Target" wait (5) h.Parent = nil hm = randplayer.Character.Humanoid hm.MaxHealth=300 --Chooses their max health hm.Health=300 --Chooses their current health wait(120) --This is where you change the leangth of the game for i = 1,#p do if p[i].TeamColor == BrickColor.new("Mid gray") then p[i].TeamColor = BrickColor.new("Bright red") end end h.Parent = workspace h.Text = "End of game" wait(4) h.Text = "Get ready for the next game" wait (4) h.Parent = nil end
0
Please use the 'Code Block' formatting option so that we can read your scripts with proper formatting! duckwit 1404 — 10y

1 answer

Log in to vote
0
Answered by
Maxomega3 106
10 years ago
print "Use the Code Block button to place your scripts! It's the Lua logo above your typing box!"

Thanks for following that ^

Here's my advice: combine the scripts. It's a lot easier than to keep them seperate. Then you'd have to use _G variables and it's a lot uglier.

while true do
    if game.Players.NumPlayers > 1 then
        --script 2 here
    else -- script 1 here
    end
end
0
sorry thanks, heres my edited post. secretdagent 0 — 10y
Ad

Answer this question