So currently im making a buff system to every target inside the ability post range, It’ll be like everytime you clicked the ability button it will activate the buff. And here come the issue, everytime there’s multiple of a tower that have the ability it will stack the buff. Is there a way i could fix this? also you activate the ability through gui
local OldFirerate = {}
for i,v in pairs(workspace.Towers:GetChildren()) do
local TowerStats = require(v.Stats)
local Distance = (newTower.HumanoidRootPart.Position - v.HumanoidRootPart.Position).Magnitude
local towerFirerate = TowerStats.Cooldown
v.Head.Material = Enum.Material.Neon
if Distance <= TowerRange then
if not OldFirerate[v] then
OldFirerate[v] = {
Cooldown = TowerStats.Cooldown
}
end
local OgCD = OldFirerate[v].Cooldown
if TowerStats.Cooldown == OldFirerate[v].Cooldown then
local newFirerate = towerFirerate * OverallBuff
TowerStats.Cooldown = newFirerate
end
end
print(TowerStats.Cooldown)
end