Client/Server Sided Cooldown help

I’ve made this cooldown system where there is a modulescript, with the info inside of there such as:

	["Magics"] = {
		["Blood"] = {
			["BloodStrike"] = {
				LastSkill = _Clock();
				Cooldown  = 10;
				Damage    = 10;
			};
		};
	};

Then on the server, and or client I require the module, and do:

		if os.clock() - Dictionary["BloodStrike"].LastSkill >= Dictionary["BloodStrike"].Cooldown then
			Dictionary["BloodStrike"].LastSkill = os.clock()

But this makes it global, meaning all players will have delayed skills, etc. I’m confused on how I should fix this. Could someone help me out?

Each player would have to have their own individual module so it doesn’t affect each other’s. So cloning it then placing it somewhere that you can identify a player’s module, all handled by the server preferably so that the client can’t cheat, but somewhere the client can see so they can at least view their status (i.e. workspace)

1 Like

So when the player is added I should make a copy of the module and name it to Player.Name…“AbilityModule”? And would replicated storage suffice?

Yes, ReplicatedStorage would replicate it so all clients and server can see the modules, but only new modifications from client would replicate to server or other clients. It’d be better to create a folder called Abilities for organization purposes and simply rename the module to Player.UserId.

1 Like