Skip to main content

Blog Archive

New Social Scripting Tricks With Telamon

December 7, 2010

by John Shedletsky



Hello ROBLOX Scripters!

In the past client release we snuck in a couple of secret functions to use in our Blazing Man place – for the most part they don’t show up in the Object Browser, however a couple of dedicated ROBLOX Lua hackers have already found them!

These new functions unlock new and exciting capabilities into your ROBLOX places – namely, access to the ROBLOX social graph. The API isn’t complete yet, and you’ll notice some obvious things are missing, but there is enough there to start to do some interesting things.

New Stuff

The Player object now has the following undocumented functions:

Player:IsFriendsWith(userId) (returns bool)

Player:IsBestFriendsWith(userId) (bool)

Player:IsInGroup(groupId) (bool)

The DataModel service now has the following properties:

game.CreatorId (int)

game.CreatorType (Enum.CreatorType)

game.PlaceId (int)

We have introduced a new enum, CreatorType. Valid values are:

Enum.CreatorType.User and Enum.CreatorType.Group

Example Usage

Check if a specific player is friends with the place creator

if (game.Players.Telamon:IsFriendsWith(game.CreatorId)) then …

Get a list of all players in a level that are not in the Roblox Currency Traders group (groupid = 16127). You can get the id for any group by going to it’s group page on ROBLOX and looking at the gid=??? part of the URL.

local enemies_of_capitalism = {}

local players = game.Players:GetPlayers()

for i=1,#players do

  if (players[i]:IsInGroup(16127) == false) then

     enemies_of_capitalism[#enemies_of_capitalism + 1] = players[i]



Test if the current place is a group place

if (game.CreatorType == Enum.CreatorType.Group) then …

Test if your script is currently running in Sword Fight on the Heights IV.

if (game.PlaceId == 47324) then …

Test if two players are mutual best friends. Remember that Best Friend relationships on ROBLOX are one-way. X can be best friends with Y without Y being best friends with X.

function CheckMutualBestFriends(player1, player2)

return player1:IsBestFriendsWith(player2.userId) and player2:IsBestFriendsWith(player1.userId)


What Can I Do With This?

ROBLOX users are super creative and I’m sure you will come up with a million ingenious things to do with these new functions. Here are some ideas to get you started. You can:

  • Make a script that gives special powers to the owner of a place (you can do this today, but you need to hardcode the creatorId, so using game.CreatorId is better)
  • Make a script that puts all your friends on a single team when they join your game, and puts people who aren’t your friends on a separate team
  • Make a weapon that damages non-friends and heals best friends
  • Make a script that gives members of your favorite group special powers
  • Make a script that makes members of an enemy group spawn in jail
  • Make a door that only friends can pass through
  • Make a secret area in your level that requires 3 members of your group to be present before it opens

We’ll be adding more functionality over time. This is just the start!

– Telamon