Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to get combine these two scripts?

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

1 comment

0

Please use the 'Code Block' formatting option so that we can read your scripts with proper formatting!

1 answer

✓ Accepted answer
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

1 comment

0

sorry thanks, heres my edited post.

This discussion is preserved as it was. New answers, comments, and votes are closed.