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

How would you begin this?

Im needing a script to where there is a time limit and if it reaches the time limit the get respawned, or if everyone but one person lives they get teleported, or if a person kills all of the players they win etc...

Basically all the murder Games lol, But I need that script and Have no Idea where to start.

1 answer

Here's a rough sketch of how it might look:

roundLength = 60

function getPlayersAlive()
	-- Look through all the players who aren't in a lobby and check if they
	-- are on the right team, etc,
	-- returning a list of players
end

function roundFindWinner()
	local startTime = tick() -- Current time
	while tick() - startTime < roundLength do
		wait(1)
		local peopleAlive = getPlayersAlive()
		if #peopleAlive == 1 then
			-- Last person standing.
			-- Different lists for different teams and checking that
			-- one of the lists is empty would work, too, depending
			-- on the rules of the game.
			return peopleAlive[1].Name
		elseif #peopleAlive == 0 then
			-- No one is left playing, so there was no winner
			return "none"
		end
	end
	-- Out of time.
	return "none"
end

while true do
	wait(5) -- Time between rounds
	local winner = roundFindWinner()
	if winner ~= "none" then
		-- `winner` is name of player who won!
	else
		-- no one won (out of time or no survivors)
	end
end

1 comment

0

Thanks, If I have Any Trouble with this script Mind Helping me? Im Not the Best With Scripting, Im Ok I can Do stuff to keep me treading water, But Just barely.

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