Script not proceeding after Pcall function

As the title says, my script is not running right after my Pcall function. The part of the script that occurs it:

local v_Ativado = function(v, tween1, tween2, Heartbeat, rollframeclone, roll)
	local nome = v.Name
	local success, err = pcall(function()
		return bindablefunction:Invoke(nome, roll)
	end)
	Sucesso_ou_error(success, err, 'Erro foi encontrado ao invokar "bindablefunction": ','Nenhum erro foi encontrado ao invokar "bindablefunction": ')

	local escolhido = rollframeclone[t[not err]]
	local nomeescolhido = tostring(escolhido)
	
	local deletadoescolhido = WaitFor(rollframeclone, nomeescolhido)
	v.Active = false
	for numero = 0, 1, 0.1 do
		Heartbeat:Wait()
		deletadoescolhido.TextTransparency = numero
	end
	coroutine.wrap(function()
		while Heartbeat:Wait() do
			task.wait(0.3)
			v.TextColor3 = Color3.new(1, 1, 0.411765)
			task.wait(0.3)
			v.TextColor3 = Color3.new(255,255,255)
		end
	end)()
	Destroy_Instance(deletadoescolhido)
	Tween_Audio_Play(tween1)
	Completed(tween1, Tween_Audio_Play, tween2)
end

I already tried printing “nome”, “roll”, “bindablefunction”, and it shows up correct, though right after the “return”, the script doesn’t proceed to the “Successo_ou_error” which is the if statement to check if the pcall function is alright or not:

erro_ou_succeso = function(succ, err, aviso, sucesso)
		if not succ then
			return warn(aviso.. err)
		else
			return print(sucesso.. tostring(succ))
		end
	end,

I already tried debugging the code, and again, it stopped running after the “return”. What is the problem here?

2 Likes

I always hate pcall9function).Sometimes it can only be used if there is any errors

2 Likes

pcall function is important to check if the function returns an error, and how to handle with that

2 Likes

And u are using INVOKE() which says that it will run that part first and if u get the result.

and also why u use return bindablefunction()
it should only be bindable function()

2 Likes

why u have return for both scripts.should only have one side

2 Likes

what are you even talking about?

2 Likes

like you seee this

local success, err = pcall(function()
return bindablefunction:Invoke(nome, roll)
end)-- why you have a return in here

remove that return and see whether it works

2 Likes

Because the pcall(function() will return the value of bindablefunction:Invoke()

2 Likes

but u have a return in the other script,so do not have to return that value

as u can see from this

erro_ou_succeso = function(succ, err, aviso, sucesso)
if not succ then
return warn(aviso… err) – there is already a return (This will send back to the main script
else
return print(sucesso… tostring(succ))
end
end,

and

local success, err = pcall(function()
return bindablefunction:Invoke(nome, roll) – since there is a return here,It will also go to ther other script

end)

Therefore this is in a loop

This is a loop because both side have return,so they will not run below,Because they are running theat success thing

1 Like

Pcall Function is used to call a function in a protective mode. I’m calling bindablefunction in a protective mode

no? It is not on a loop. Everything you said makes no sense at all.

U try and remove return,see it works or not.because the main script should not have any returns

only either client or server will have return not BOTH

It will be the same thing. Implementing various returns won’t make the function recursive. Instead, I’m calling return because I need to return the value of the bindable function to the protective function. Additionally, I already tried removing the return before, and still nothing, as it makes no sense removing it.

Sorry to tell u this

Pcallfunctions is also a loop.so u need to

can u show me the entire script,I am also confused

ENITRE SCRIPT DONT SEPEARTE INTO CHUNKS BECAUSE IT IS HARD TO UNDERSTAND

False. The return statement is used to exit the current function and return one or more values (tuple) to the caller. Here, it’s inside an anonymous function that’s being passed to the protective call.

In other words, success will be a boolean value if the function worked or not, and the err will be the err occurred, if none, the bindable function return.

I think you probably should learn more about that. I see you are not a programmer, so I don’t think you could resolve my problem here. I appreciate the help.

Pcall function is not a loop:

ENITRE SCRIPT DONT SEPEARTE INTO CHUNKS BECAUSE IT IS HARD TO UNDERSTAND