Hello!, so im added a value and thats working fine but when i subtract a value there are no errors but it’s not subtracting any values
elseif condition == "Un-equipped" then
for index, equippedArmor in pairs(plr.Character:GetChildren()) do
if equippedArmor:IsA("Model") then
equippedArmor:Destroy()
plr.Data.Damage.Value = plr.Data.Damage.Value - dps.Value -- Player's Damage isn't being subtracted
end
end
end
local armorFolder = game.ReplicatedStorage.Equipment
game.ReplicatedStorage.Events.EquipArmor.OnServerEvent:Connect(function(plr, armor, condition, dps)
print(dps)
plr.Data.Damage.Value = plr.Data.Damage.Value + dps
if condition == "Equipped" then
for index, equippedArmor in pairs(plr.Character:GetChildren()) do
if equippedArmor:IsA("Model")and armor then
equippedArmor:Destroy()
end
end
for index, chosenArmor in pairs(armorFolder:GetChildren()) do
if chosenArmor.Name == armor then
local chosen = chosenArmor:Clone()
chosen.Parent = plr.Character
for index, armorParts in pairs(chosen:GetChildren()) do
for index, playerParts in pairs(plr.Character:GetChildren()) do
if playerParts:IsA("BasePart") then
if armorParts.Name == playerParts.Name then
armorParts.PrimaryPart.CFrame = playerParts.CFrame
local weld = Instance.new("WeldConstraint")
weld.Part0 = playerParts
weld.Part1 = armorParts.PrimaryPart
weld.Parent = armorParts.PrimaryPart
end
end
end
end
end
end
elseif condition == "Un-equipped" then
for index, equippedArmor in pairs(plr.Character:GetChildren()) do
if equippedArmor:IsA("Model") then
equippedArmor:Destroy()
print(dps)
plr.Data.Damage.Value = plr.Data.Damage.Value - dps
end
end
end
end)