Can "return" return at a line

Hello guys !

When we use return in a if statement can it return at the start of the function or not ?

I want that return make the script going at this line to repeat the script instead that stop it

			local result
			if player.AuraCount.Value >= player.MaxAura.Value then
				player.PlayerGui.StorageUI.Enabled = true
				player.PlayerGui.StorageUI.StorageFrame.Visible = true
				player.PlayerGui.StorageUI.StorageFrame.WarningDeleteandAmount.Visible = true
				player.PlayerGui.StorageUI.StorageFrame.WarningDeleteandAmount.TextWarning.Text = "Delete an aura to store "..auraname
				result = player.PlayerGui.StorageUI.StorageFrame.WarningDeleteandAmount.No.MouseButton1Click:Connect(function()
					player.PlayerGui.StorageUI.StorageFrame.Visible = false
					player.PlayerGui.StorageUI.StorageFrame.WarningDeleteandAmount.Visible = false
					return true
				if result.Connected == true then return end
					SkipWarning.Visible = false
					StoreBTN.Active = false
					EquipBTN.Visible = false	

if you guys can help i’ll appreciate it :slight_smile:

There’s good and bad news.

The bad news is that…

Return cannot accomplish what you want

The good news is that…

You can easily do what you want without directly using return like this:

local function onClick()
    -- your code
    if result.Connected then onClick() return end


If you need an explanation, I gotchu

I don’t know about the second MouseButton1Click in your function but uhh I can help sort that out too if needed

The second mouseclick in the script its because the player need to click 2 times on the button to store his aura, because if he has his inventory full he need to remove some auras and after removing auras he need to click again

I think there are ways to do this thing with only one mouseclick but im still a beginner :slight_smile: and can you explain me why what u did pls ?

1 Like

oh no I understood your code after I wrote my message, thanks i’ll try it :grin:

1 Like

But yeah don’t forget to add your code since I removed it so you could see what’s going on :slight_smile:

1 Like

I got a problem, in the video at 7 seconds it show my inventory like I want, when I click on no (so I didn’t sell any auras) that do nothing. Same for equip first click that works but when I click on “No” that do the script like I sold one aura how can I do like it show again the inventory until an aura is sold ?

1 Like

Nevermind im idiot my bad I fixed it thank you !

1 Like

Mb for the late response. Glad you got it solved though!

1 Like