How to count remote firing

Hello developers, so right now I’m trying to make a Server Script for monitoring how many times a RemoteEvent gets fired. I know nothing about tables or how I should approach this. Any/All help is appreciated

local Remote = game.ReplicatedStorage.RemoteEvent
local TBLReset_Time = 5

local player_TBL = {}

Remote.OnServerEvent:Connect(function(player)
	-- no idea what else to do here
end)

Just create a variable named countsOfFired before the event, then whenever someone fires it, do:

countsOfFired += 1

Simple as that.

I’m not sure how I would apply this, may I have an example?

Use your logic. Think how you’re gonna use it. Don’t just straight away ask me the script.

No, I really don’t. Because for every function its different, and for my limited knowledge without a table you can’t just create variables

I think you misunderstood what I was saying-

You want it per player, so you can do something like

local player_TBL = {}

Remote.OnServerEvent:Connect(function(player)
	if player_TBL[player] then
		player_TBL[player] += 1
	else
		player_TBL[player] = 1 -- first time firing
	end
end)

which uses the player as the key, incrementing their existing spot in the table, otherwise setting it to 1 since it is their first time.

1 Like