Skip to content

Rounds

The round system is the core of Fazbear's Hunt. With update 3.0.0, creating custom round types has become significantly easier.

Registering a round type

fh.RegisterRoundType(name, id, func, [weight], [minPlayers], [maxPlayers]) SERVER

Registers a new round type. Returns the ID and technical name of the round.

Parameters:

NameTypeDescription
namestringTechnical name of the round in English
idint / stringRound ID. If string, automatically converted to a number
funcfunctionFunction executed when the round starts
weightint (opt.)Chance of occurring (0–100)
minPlayersint (opt.)Minimum number of players
maxPlayersint (opt.)Maximum number of players

Example:

lua
local id, name = fh.RegisterRoundType("springtrap_madness", "spring_mad", function()
    -- Give everyone Springtrap!
    for _, ply in player.Iterator() do
        giveKiller(ply, "pill_springtrap", true)
    end
end, 5, 4, 16)  -- 5% chance, 4–16 players

print(id, name) -- 43700 springtrap_madness

Round management

fh.SetRoundTypeBlocked(id, block) SERVER

Blocks a round by ID, preventing the game from selecting it.

lua
-- Block the Springtrap round
fh.SetRoundTypeBlocked(1, true)

Getting round information

fh.SetRoundType(number) SERVER

Sets the round type. The mode calls this itself at the start of a round.

Be careful

Use only if you know exactly what you're doing.

fh.GetRoundType() SERVER

Returns the current round type.

ValueRound type
0Normal
1Springtrap
2Bonnie-Tag
3Infection round with Bear5

fh.GetRoundTypes() SERVER

Returns a table with all registered round IDs.

lua
local all = fh.GetRoundTypes()
PrintTable(all)

fh.GetRoundTypeByName(name) SERVER

Returns the round ID by its technical name.

lua
local id = fh.GetRoundTypeByName("springtrap_madness")
print(id)  -- 12345 (for example)

fh.GetRoundTypeNameByNumber(id) SERVER

Inverse function — returns the name by ID.

lua
local name = fh.GetRoundTypeNameByNumber(1)
print(name)  -- "springtrap"

Round music

fh.AddRoundMusic(num, music) SERVER

Adds a music theme for the start of a specific round type.

Override not possible

Already registered music cannot be overridden.

lua
fh.AddRoundMusic(
    fh.GetRoundTypeByName("springtrap_madness"),
    "music/my_addon/madness_theme.mp3"
)

fh.GetRoundMusic(num) SERVER

Returns the path to the round start music. If no music is found for the specified type, returns the normal round music.

See also: Round hooks →