Help with Round System?

Been Making a game sort of like forsaken and I need to make a round system where a killer gets picked. I managed to make this round system but I’m unsure on how to make a killer picking system with a different spawn point. (I don’t want to quit this game so it’d be nice if someone helped)

Server Script:

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local INTERMISSION_TIME = 5
local ROUND_TIME = 10
local MIN_PLAYERS = 2

local function TeleportPlayers(cFrame)
	local players = Players:GetPlayers()
	for i, player in players do
		if not player.Character then continue end
		
		player.Character:PivotTo(cFrame)
	end
end

local function Countdown(duration)
	for i=duration, 1, -1 do
		workspace:SetAttribute("Clock", i)
		task.wait(1)
	end
end

local function Intermission()
	print("INTERMISSION")
	workspace:SetAttribute("Status", "Intermission")
	TeleportPlayers(workspace.SpawnLocation.CFrame * CFrame.new(0, 2, 0))
	Countdown(INTERMISSION_TIME)
end

local function RunGame(newMap)
	print("GAME STARTED")
	workspace:SetAttribute("Status", "Game")
	TeleportPlayers(newMap.Spawn.CFrame)
	Countdown(ROUND_TIME)
	
	newMap:Destroy()
end

while true do
	if #Players:GetPlayers() >= MIN_PLAYERS then
		Intermission()
		
		workspace:SetAttribute("Status", "Loading Map...")
		local maps = ReplicatedStorage.Maps:GetChildren()
		local randomMap = maps[math.random(#maps)]
		local newMap = randomMap:Clone()
		newMap.Parent = workspace.CurrentMap
		
		task.wait(1)
		
		RunGame(newMap)
	else
		print("WAITING FOR PLAYERS...")
		workspace:SetAttribute("Status", "Waiting For Players.")
		task.wait(1)
	end
end

Local Script (For GUI)

local gui = script.Parent


local function UpdateStatus()
	local clockTime = workspace:GetAttribute("Clock")
	local gameStatus = workspace:GetAttribute("Status")
	
	if gameStatus == "Game" or gameStatus == "Intermission" then
		gui.Label.Text = gameStatus .. ": " .. clockTime
	else
		gui.Label.Text = gameStatus
	end
end

workspace:GetAttributeChangedSignal("Clock"):Connect(UpdateStatus)
workspace:GetAttributeChangedSignal("Status"):Connect(UpdateStatus)

UpdateStatus()
1 Like

To make a killer picking system, first you need to store the killer model somewhere (probably in ServerStorage). When the round starts, you then pick the killer model from where it is located. You clone it, and parent it to the map with the killer system and etc. When round finishes, you then destroy the killer and loop into the intermission again.

How would I format a round system? - #10 by MysteryX2076

Check this post for formatting a round system (this may help you in the future).

1 Like

I meant picking a player as the killer but I got it figured out now so I’ll be marking this post as solved

this post is solved now I used the roblox ai lol

1 Like

You could just do:

local plrs = game:GetService("Players")
local all = plrs:GetPlayers()

local randomPlr = all[math.random(1, #all)]

what was the solution the ai gave?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.