so i have an issue with my module script, i have a part with a click detector in it an a script whenever the button is pressed the module script is fired, however for the second if statement bellow breaks the for, loop without the break statement, the script doesnt work as intended. with the break vallue the script doesnt contuie to the next s value in the for i ,s loop. is there somethign i can replace the break statement with, so that it stops if its true and skips to the next value?
elseif s:IsA("TextLabel") and s.Taken.Value == true and amt < 10 and debounce == false then
debounce = true
amt = amt +1
debounce = false
break
local rs = game:GetService("ReplicatedStorage")
local module = {}
local amt = 0
local debounce = false
module.skillgiver = function(player,SkillName)
--// Save the old amount at the time of function call, so we can track changes
local OldAmount = amt
for _, v in player.Backpack:GetChildren() do
--// Here we check if the value has changed. If changed, we break the main loop
if amt ~= OldAmount then
break
end
if v.Name == SkillName then
for _,s in player.PlayerGui.keybindFrame.Frame:GetChildren() do
if s:IsA("TextLabel") and s.Taken.Value == false and debounce == false then
local toolui = rs.TextLabel
local UiClone = toolui:Clone()
debounce = true
UiClone.Parent = player.PlayerGui.HotbarFrame.Frame
UiClone.Position = s.Position
s.Taken.Value = true
amt = amt + 1
debounce = false
break
elseif s:IsA("TextLabel") and s.Taken.Value == true and amt < 10 and debounce == false then
debounce = true
amt = amt +1
debounce = false
break
elseif s:IsA("TextLabel") and s.Taken.Value == true and amt >= 10 and debounce == false then
debounce = true
local toolui = rs.TextLabel
local UiClone = toolui:Clone()
UiClone.Parent = player.PlayerGui.Inventory.ScrollingFrame
UiClone.TextLabel.Visible = false
debounce = false
end
end
print(OldAmount)
else
print("else")
end
end
end
return module