local QBCore = exports['qb-core']:GetCoreObject() RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() Citizen.CreateThread(function() FetchSkills() while true do local seconds = Config.UpdateFrequency * 1000 Citizen.Wait(seconds) for skill, value in pairs(Config.Skills) do UpdateSkill(skill, value["RemoveAmount"]) end TriggerServerEvent("skillsystem:update", json.encode(Config.Skills)) end end) RegisterNetEvent('QBCore:Client:OnPlayerUnload', function() for skill, value in pairs(Config.Skills) do Config.Skills[skill]["Current"] = 0 end end) end) AddEventHandler('onResourceStart', function(resource) if resource == GetCurrentResourceName() then Wait(100) FetchSkills() end end)