I added an else statement and it printed “No Thanks” 19 times
elseif condition == "Un-equipped" then
for index, equippedArmor in pairs(plr.Character:GetChildren()) do
if equippedArmor:IsA("Model") then
equippedArmor:Destroy()
print(dpsval)
plr.Data.Damage.Value = plr.Data.Damage.Value - dpsval
else
warn("No thanks") --Printed this 19 times
end
end
end
local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local dps = player:WaitForChild("Data").EquippedValue
local holder = script.Parent.Parent.Holder
local Events = game.ReplicatedStorage.Events
local folder = script.Parent.Parent.Inventory.Duplicates
local dpsval = dps.Value
for index, child in pairs(script.Parent:GetChildren()) do
if child:IsA("TextButton") then
child.MouseButton1Click:Connect(function()
if child.Name == "Equip" then
if child.Text == "Equip" then
for index, armor in pairs(folder:GetChildren()) do
if armor:IsA("ImageButton") then
if armor.IsSelected.Value == true then
armor.Equipped.Value = true
armor.IsSelected.Value = false
Events.EquipArmor:FireServer(armor.Name, "Equipped", dpsval)
print(dps.Value)
script.Parent.Visible = false
else
armor.Equipped.Value = false
end
end
end
elseif child.Text == "Un-equip" then
for index, armor in pairs(folder:GetChildren()) do
if armor:IsA("ImageButton") then
if armor.IsSelected.Value == true then
armor.Equipped.Value = false
armor.IsSelected.Value = false
Events.EquipArmor:FireServer(armor.Name, "Un-equipped", dpsval)
print(dps.Value)
script.Parent.Visible = false
end
end
end
end
elseif child.Name == "Cancel" then
for index, armor in pairs(folder:GetChildren()) do
if armor:IsA("ImageButton") then
if armor.IsSelected.Value == true then
armor.IsSelected.Value = false
end
end
end
script.Parent.Visible = false
end
end)
end
end
It does taht cause it loops through all your children in your character, I presume it’s not printing the value of dps? If not, then it’s not finding a single model in your character