Preventing duplication glitches in your game

It has come to my attention that users can exploit a lot of trading systems in most games by using hacks to allow themselves to play the same game in two different servers whilst on the same account.

This is a known issue that does happen and can cause a lot of games to go downhill when it comes to their economy.

So how do we fix this? Well the new messaging service makes it very easy to solve this issue!

Simply use the code in ServerScriptService for this place:

local PlayerSessions = {} --Creates a place to store the GUIDs for each user

game.Players.PlayerAdded:Connect(function(plr)
	local connection
	connection = game:GetService("MessagingService"):SubscribeAsync(plr.UserId,function(dat)--We create a subscription for the user checking for any new calls to the function
		if dat.Data ~= PlayerSessions[plr.UserId].ID then--This ignores your own player in the same server
			plr:Kick("Found the same player in another server!")
			connection:Disconnect()--We disconnect the event from the function so we don't get rate limited
			game:GetService("MessagingService"):PublishAsync(plr.UserId,PlayerSessions[plr.UserId].ID)--This sends out a publish async to the subscription we just created. In this case if there were two servers with the same user, the subscription on both servers would kick both users. It really acts as a call back to the original server for confirmation
			PlayerSessions[plr.UserId] = nil--we don't want extra garbage in the table
		end
	end)
	PlayerSessions[plr.UserId] = {
		ID = game:GetService("HttpService"):GenerateGUID(false);--This makes a temporary unique id for the client
		Connection = connection;--This stores the connection for your player in this server incase they leave
	}
	game:GetService("MessagingService"):PublishAsync(plr.UserId,PlayerSessions[plr.UserId].ID)--This sends the initial check to see if there are two or more clients
end)

game.Players.PlayerRemoving:Connect(function(plr)
	PlayerSessions[plr.UserId].Connection:Disconnect()--See this disconnects that connection we made in the playeradded function
	PlayerSessions[plr.UserId] = nil
end)

Here’s how this works, when your player joins a server, the game puts your user into a table inside the script with a generated GUID. The server then sends out a publish async with the key being your userid. We do this because we also set up a subscription on your userid so if there’s two separate servers with the same player and the GUID doesn’t match then it’ll kick both players instantly.

6 Likes

This topic was automatically closed after 1 minute. New replies are no longer allowed.

This is really good however I have a few questions

Is it possible for GUID to generate the same result or it’s almost impossible?

MessagingService is still in Beta , can be Unreliable at times and it has Limits;

What if I use DataStore instead of MessagingService to achieve the same thing?

So my idea is you would Save when the Player is Playing, so in their Data set Playing = true and then when they leave set Playing = false

This is false, ROBLOX will automatically disconnect the other client when you attempt to join a game on the same account. No exploit like this exists.

1 Like

You can get the same result doing this with datastores as well. Also the guid generation has a very low chance of creating the same id so I wouldn’t worry.

No disrespect intended, but what exactly is the point of managing players like this?

From what I remember, Roblox doesn’t allow the same user to have multiple clients running at the same time regarding of the device(s) they’re running Roblox on.

Possible misunderstanding? @Kurookku

That’ what I’ve been able to find, it’s also easy to execute that but it shouldn’t be a problem, if you design your Economy well enough these things shouldn’t effect it

@congrajhulashions Actually yes, it’s easily done

1 Like

Could you provide me some evidence of this? I’m rather intrigued in this considering I just told someone this wasn’t possible 15 minutes ago.

You can find more with a Google search and the Link I’ve provided.

But in short;

You can run 3 Roblox Instances on 1 PC,

Using the normal Roblox Client , the Roblox thing from Windows 10 store and Bluestacks

With 3 accounts of course, and this doesn’t account for using a Virtual Machine so technically you can have an infinite number of Instances depending on your Computer’s Spec and Internet

1 Like

Correct me if I’m wrong, but I believe the situation in this thread was regarding the fact that one user can run 2 or more clients at the same time.

In the case of the video, again, correct me if I’m wrong, both accounts are different.

You can run multiple Roblox Instances at the same time with the same amount of accounts on a PC

I’m unsure if you can have the same account on multiple Roblox Instances.
(I’ve never done it before)



I was confused by your statement and sorry for the confusion.

1 Like

Apologies for the confusion, and not a problem! :slightly_smiling_face:

1 Like

This is a really unnecessarily thread as you’ve completely misunderstood what is possible with applications that allow you to run multiple instances of the Roblox client. They do in fact allow you to have multiple accounts open on the computer. But thats as far as their scope goes.

I can assure you players cannot;

  • Connect the same account to the same game
  • Connect the same account to different games

And also in response to @RuizuKun_Dev, these methods are the easiest people have access to in which you listed however there is a free application which I wont advertise by name that allows you to run multiple of the standard Roblox clients. No need for Windows Store, VMs, nothing.