How to properly use PCall in this situation?
Hey there,
I'm currently having issues using pcall properly. My loadstring is executing, but without the argument provided, and not functioning properly. Here's what I'm up to:
01 | function confirmCommand(gameCommand) |
02 | local success, message = pcall (execCommand(gameCommand)) |
05 | print ( "An error occured: " .. message) |
09 | function execCommand(executedCommand) |
10 | loadstring (executedCommand) |
This is the "secret" script, which is another error I get. It says error loading module yet it still works each time.
1 | require(game.Workspace.Module) |
Yes, it's one line.
Here are the errors I receive each time:
01 | 14 : 30 : 21.559 - Requested module experienced an error while loading |
02 | 14 : 30 : 21.559 - Stack Begin |
03 | 14 : 30 : 21.559 - Script 'Workspace.secret' , Line 1 |
04 | 14 : 30 : 21.560 - Stack End |
05 | 14 : 30 : 21.560 - Workspace.Module: 32 : bad argument # 1 to 'pcall' ( function expected, got no value) |
06 | 14 : 30 : 21.560 - Stack Begin |
07 | 14 : 30 : 21.561 - Script 'Workspace.Module' , Line 32 - global confirmCommand |
08 | 14 : 30 : 21.561 - Script 'Workspace.Module' , Line 18 - global checkCommand |
09 | 14 : 30 : 21.561 - Script 'Workspace.Module' , Line 76 |
10 | 14 : 30 : 21.562 - Stack End |
Does anyone know what I'm doing wrong?