Back to Library
Utility Nov 22, 2025

Building Whitelist

T
by terrorsoul

Only allows building for users in the whitelist

LUA
-- Table of allowed Profile IDs
local whitelistedUsers = {
    ["1r81vc3f34d1ce0002f08a51"] = true -- Replace with an actual ID, add as many as you need
}

function EnforceBuilderWhitelist(player)
    -- Get the unique profile ID of the player joining
    local myProfileId = tm.players.GetPlayerProfileId(player.playerId)
    
    -- Check if this ID exists in our allowed table
    if whitelistedUsers[myProfileId] then
        -- ALLOW: Enable builder for whitelisted
        tm.players.SetBuilderEnabled(player.playerId, true)
        tm.playerUI.AddSubtleMessageForPlayer(player.playerId, "WHITELISTED", "Builder Access Granted", 3, "")
    else
        -- DENY: Disable builder for non-whitelisted
        tm.players.SetBuilderEnabled(player.playerId, false)
        tm.playerUI.ShowIntrusiveMessageForPlayer(player.playerId, "RESTRICTED", "Building is whitelist only.", 5)
    end
end

-- Run this check every time a player joins the server
tm.players.OnPlayerJoined.add(EnforceBuilderWhitelist)

Discussion

Please log in to post a comment.