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)
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.