Back to Library
UI Nov 25, 2025

Add UI Button

T
by terrorsoul

When a player joins they get a button added to their hud that when pressed sends them a subtle message

LUA
function sendMessage(callbackData)
    tm.playerUI.AddSubtleMessageForPlayer(callbackData.playerId, "Hello", tm.players.GetPlayerName(callbackData.playerId), 3, "")
end

function onPlayerJoined(player)
    tm.playerUI.AddUIButton(player.playerId, "playerbtn" .. tostring(player.playerId), "Press for Message", sendMessage, player.playerId) -- When a user presses the button it calls the function sendMessage
end

-- Add new UI to the player that joins
tm.players.OnPlayerJoined.add(onPlayerJoined)

Discussion

Please log in to post a comment.