So my initial thought was using return but it only stops the if question (I think, not sure), not the function itself.
here is a part of my code that i'm having trouble with.
Progress:GetPropertyChangedSignal("Value"):Connect(function() -- whenever progress changes
if Progress.Value >= MaxProgress.Value then -- check if progress already reached the max progress cap required to finish
PLN.Value = PLN.Value + goldreward.Value -- rewarding
XP.Value = XP.Value + xpreward.Value
plr.leaderstats.QuestsDone.Value = plr.leaderstats.QuestsDone.Value + 1 -- adding one quest to quests done
print(plr.leaderstats.QuestsDone.Value + 1, plr.leaderstats.QuestsDone.Value)
-- clearing the values
xpreward.Value = 0
goldreward.Value = 0
Progress.Value = 0
QuestID.Value = ""
MaxProgress.Value = 0
gui.Title.Text = texttitle
gui.Subtitle.Text = textsubtitle
return
end
end)
When i call this function again it just doubles the outcome, I deducted it's because the function didn't stop in the first place.

1 comment
A return is unnecessary if it is the end of the function.