hello, i don’t understand why this else statement is not working. When the level is 0 and selected is “”, and dungeonName = “” it works but when it’s not it doesn’t work why?
print(Selected)
print(level)
if Selected == "" then
print("not Selected")
if level <= 0 then
print("levle")
if DungeonName == "" then
print("Error")
script.Parent.Parent.Errormsg.Visible = true
wait(1)
script.Parent.Parent.Errormsg.Visible = false
else
game.ReplicatedStorage.Events.CreateParty:FireServer(hardcore, Selected, level, DungeonName, GamesMade)
print("Fired")
script.Parent.Parent.Parent.CreateFrame.Visible = false
yes, im making sure if the selected is an actual string and not empty, if the level is higher than 0, and if the dungeon is an actual dungeon and not blank. Before creating the party
I’m confused, I thought you wanted to check all 3 of them were valid before creating the party?
The difference between your code and my code is that in your code if selected was not empty, then it would not check the rest of the variables. However, with mine, it would go through each variable until it reaches an invalid one or the end of the statements.
Please correct me if I am wrong, I may be misunderstanding!
doesn’t elseif check if one of those is right, if one of these is true then it’s going to work im pretty sure since i didn’t add a name to the party but it still let me create it
if Selected == "" then
print("not Selected")
valid = false
elseif level <= 0 then
print("levle")
valid = false
elseif DungeonName == "" then
On line 1 (of the shortened code you just put), it will check if selected is empty. If so, then valid = false and the party will not be created. If slected is not empty, the statement is false and therefore it moves onto line 4, the first elseif. If level is less than or equal to 0, the statement is true and valid = false, and the party will not be created. If level is higher than 0, then it moves onto the last else if, if dungeon name is empty. If it is empty, then valid = false. Otherwise, the end of the if statement is reached, and valid is still equal to true, and the party is created.
Is this what you wanted? Hopefully I’m not just being really stupid and misunderstanding simple code.