Randomly chosen round map!

could you send me the error message?

Script - Roblox Studio 18-5-2021 14_01_10
@Expistic sorry that it took long, something in my room fell down and I had to pick it up.

1 Like

^^ Delete this line of code at the very top.

Error is gone, but I still don’t teleport to one of the bricks I’ve put into the folder.

Let me take a look really quick.

Do you think you can send a picture of ReplicatedStorage?

If you are interested in a video :slight_smile:

The blue blocks are the things i want to spawn to. They are in the teleports folder.

Sure!

^^^requested access to view the drive.^^^

Under construction seeking game - Roblox Studio 18-5-2021 14_14_26

Oops, ill fix that
Edit: should work now

local roundLength = 5 -- How long the round is in seconds
local intermissionLength = 5 -- How many seconds are inbetween the rounds

local InRound = game.ReplicatedStorage.InRound
local Status = game.ReplicatedStorage.Status
local LobbySpawn = game.Workspace.LobbySpawn
--local GameAreaSpawn = game.Workspace.GameAreaSpawn

InRound.Changed:Connect(function()
	if InRound.Value == true then
		for i, player in pairs(game.Players:GetChildren()) do
			local char = player.Character
			local posFolder = workspace.Teleports:GetChildren()
            local randPos = posFolder[math.random(1, #posFolder)]
            char:MoveTo(randPos.Position)
		end
	end
end)

local function roundTimer()
	while wait() do
		for i = intermissionLength, 0, -1 do
			InRound.Value = false
			wait(1)
			Status.Value = "Intermission: ".. i .." seconds left!"
		end
		for i = roundLength, 0, -1 do
			InRound.Value = true
			wait(1)
			Status.Value = "Game: ".. i .." seconds left"
		end
	end
end

spawn(roundTimer)

here i changed the loop type from _, to i,

just wanna see if thats the issue here

Everything works now.
But. it teleports you to whatever part is closest to the player for some reason :grimacing:

Can i have a video? that would help, haha

Sure. Im recording it right now!

thanks a trillion! sorry for the trouble haha

Nevermind! it fixed itself! Not sure why it did that

I think you may have gotten lucky enough for it to teleport you to the closest one every time, haha. Should be randomized, though.

I’ve been really lucky then, it happened 6 times in a row lol

Anyways, it’s awesome. Thanks for the help!

1 Like

No problem! :smiley: happy developing and good luck with your project.

1 Like
spawn(roundTimer)

Hey, I know you guys found a solution, but you could also use coroutine instead of spawn. Its newer and has a lot more functions! I suggest you take a look, it is really useful @OP:
Info about coroutines
Why coroutines are better than spawn
(If you don’t wanna read the argument, coroutines INSTANTLY execute the code in a new thread. Spawn has a small wait() that is built in before running code.)

1 Like