Blocking trade requests

I’m trying to make a pet trade system in the game I’m working on. Everything is ready, two players can safely exchange pets with each other properly. But what i failed to do is to detect players who want to block trade requests and show it on all clients. They shouldn’t be able to send him a trade request. Can you give an idea on how I can do it?

A player should have a list of blocked players. When a trade request is received they should check if that player’s name is on the blocked list and ignore it if it is.

local blockedTraders = {"Noob", "Bob"}

local function CheckBlocked(player : Player)
	for _, name in blockedTraders do
		if name == player.Name then
			return true
		end
	end

	return false
end

4 Likes

where should i store the blocked players list of each player. Is it on server, rep storage or client?

2 Likes

everytime a player turns trades off, insert them to a blocked table then use the code above

2 Likes

You should load and save it from a DataStore, when the player is in game it can just be kept in a table as shown.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.