How can i make this work?

alright, still Thank you for helping me out with writting full codes! :smile:

I might just found an Error in the code!

What is the error that you found?

Never mind Iā€™ve had a script in the workspace that messed up everything :grimacing: let me see if the same thing as earlier pops up again!

so it still says ā€œEveryone has Diedā€ Let me look if there is something wrong in the code again!

1 Like

@BoredHelperDEV i canā€™t find any solution and also idk how to write the issue i have to google it gave me the wrong thing! please give me some tipps! :slightly_frowning_face:

Are there any errors that show in the output?

No there arent thats why im so lost rn :worried:

Do you still have no Teams? So the people are not added to a team?

no i donā€™t have teams! should i have teams??

No, you should not. Did you try adding debug prints?
Try adding some prints if you havenā€™t done so already

ive done so already and there arent any errors

What does it print in the output though?

lemme make them again be right back

thats all it prints (update is for leaderboard)

That is an error. Could you share the whole code here?

sure but ive tried to add premium benifits that gives the double of the coins you should get

heres the code i use:


local intermission = 30
local roundLength = 170

local inRound = game.ReplicatedStorage.InRound
local staus = game.ReplicatedStorage.Status

inRound.Changed:Connect(function()
	if inRound.Value == true then
		for _, plr in pairs(game.Players:GetPlayers()) do
			local char = plr.Character
			local humanRoot = char:FindFirstChild("HumanoidRootPart")

			if humanRoot then
				humanRoot.CFrame = game.Workspace.DropGame.RoundSpawn.CFrame
			end
		end
	else
		for _, plr in pairs(game.Players:GetPlayers()) do
			local char = plr.Character
			local humanRoot = char:FindFirstChild("HumanoidRootPart")

			if humanRoot then
				humanRoot.CFrame = game.Workspace.Lobby.LobbySpawn.CFrame
			end
		end
	end
end)

local function round()    
	while true do
		local requiredPlayers = 1

		repeat
			wait(1)
			staus.Value = "At least ".. requiredPlayers.." players are needed to start a round"
		until #game.Players:GetPlayers() >= requiredPlayers

		inRound.Value = false

		for i = intermission, 0, -1 do
			staus.Value = "Game will start in "..i.." seconds"
			wait(1)

		end

		inRound.Value = true

		local roundEnded = false
		local winningPlayer = nil

		for i = roundLength, 0, -1 do
			staus.Value = "Game will end in "..i.." seconds"
			local playing = {}

			for _, plr in pairs(game.Players:GetPlayers()) do
				if plr.Team == nil then
					table.insert(playing, plr)

				end
			end

			if #playing == 0 then
				staus.Value = "Everyone Has Died"
				roundEnded = true 
				break
			end

			if #playing == 1 then
				local winner = playing[1]
				staus.Value = winner.Name.." Has Won The Game!"
				winningPlayer = winner
				roundEnded = true

				break
			end

			wait(1)
		end

		if not roundEnded then
		end

		if winningPlayer then
			-- Player has won the game, Add more code here if you want to.
			local randomCoins = math.random(20, 100)
			winningPlayer.leaderstats.Wins.Value += 1
			winningPlayer.leaderstats.Coins.Value += randomCoins
			if winningPlayer.MembershipType == Enum.MembershipType.Premium then
				randomCoins.Value += randomCoins*2
			else
				randomCoins.Value += randomCoins

			end
		end

		wait(3)
	end
end

spawn(round)

You could try this code, Note that iā€™m not able to test your code but it might work.
Try not to reply so much btw, try to put multiple questions (if you have any) or multiple stuff in 1 reply.
We donā€™t want this topic to be 100 posts long. Although i did fix your premium code and possibly the round system as well i do want you to learn from the code if you havenā€™t done so already.
Iā€™ve also added a function to set the Status value since it looks better.

Let me know if it doesnā€™t work :+1:

local intermission = 30
local roundLength = 170

local inRound = game.ReplicatedStorage.InRound
local status = game.ReplicatedStorage.Status

local function SetStatusMessage(message)
    status.Value = message
end

inRound.Changed:Connect(function()
    if inRound.Value == true then
        SetStatusMessage("In Round")
    else
        SetStatusMessage("In Lobby")
    end
end)

local function round()    
    while true do
        local requiredPlayers = 1

        repeat
            wait(1)
            SetStatusMessage("Waiting for players...")
        until #game.Players:GetPlayers() >= requiredPlayers

        inRound.Value = false

        for i = intermission, 0, -1 do
            SetStatusMessage("Game will start in "..i.." seconds")
            wait(1)
        end

        inRound.Value = true

        local roundEnded = false
        local winningPlayer = nil

        for i = roundLength, 0, -1 do
            SetStatusMessage("Game will end in "..i.." seconds")
            local playing = {}

            for _, plr in pairs(game.Players:GetPlayers()) do
                if not plr.Team then
                    table.insert(playing, plr)
                end
            end

            if #playing == 0 then
                SetStatusMessage("Everyone Has Died")
                roundEnded = true 
                break
            end

            if #playing == 1 then
                local winner = playing[1]
                SetStatusMessage(winner.Name.." Has Won The Game!")
                winningPlayer = winner
                roundEnded = true
                break
            end

            wait(1)
        end

        if not roundEnded then
            SetStatusMessage("The round has ended")
        end

        if winningPlayer then
            -- Player has won the game, Add more code here if you want to.
            local randomCoins = math.random(20, 100)
            winningPlayer.leaderstats.Wins.Value += 1
            if winningPlayer.MembershipType == Enum.MembershipType.Premium then
                randomCoins = randomCoins * 2
            end
            winningPlayer.leaderstats.Coins.Value += randomCoins
        end

        wait(3)
    end
end

spawn(round)

So basicly the script works and stuff but i think you forgot to add the function of teleportion but i may know how to do it! thank you !