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

How do I make a endless round loop number just like Cod Zombies?

The only problem I have about creating a cod zombies game is the round number.

How do I change it without typing: game.StarterGui.ScreenGui.Round.Text = "round 1, 2"

because if someone survives 200 rounds in my game it wont show because there is no way I will copy and paste everything up to 200 rounds.

2 answers

The .. operator allows you to combine strings.

You can add number to a script with the following lines of code:

local var1 = "Hello"
local var2 = " World"
print(var1..var2) -- Hello World

Its a different process with a number, since you can't combine number and a string, or it will return an error.

local var1 = "Round "
local var2 = 1
print(var1..tostring(var2)) -- Round 1

Comment any questions.

This is what for loops are useful for. I don't understand much about your game or what is in your script but if you use a for loop you can automatically do this - you don't need to copy and paste lots of variables. Example:

local wave = 0
local zombies = 0
local workspace = game.Workspace:GetChildren()

for i,v in pairs(workspace) do
	if v.Name = "zombie" then
		zombies = zombies +1
	end
end

if zombies == 0 then
	wave = wave + 1
end

You need to script in a part where the zombies variable is decreased each time a zombie dies - I can't die that since as I said I don't know much about your game (workspace details, etc)

This obviously isn't a very detailed or "good" script, but it should work if you script it correctly. Also make sure you serverside it or it'll be only on the client's side.

2 comments

0

I am talking about when everyone kills zombies the round number text changes i wanna know how to do it without copy and pasting it and changing number.

0

There.

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