Dialogue Editor executes condition/action modules in Edit mode

The Dialogue Editor supports creating custom Lua conditions/actions for dialogue through ModuleScripts. These modules are required at runtime to determine the behavior of the dialogue. However, these modules are also loaded in Edit mode when attempting to edit the dialogue for an NPC: repro.rbxl (72.8 KB)

The condition for the first prompt is set up like so:

local callback = game:GetService("ReplicatedStorage"):WaitForChild("CanUseDialogue")
return function(player, dialogueFolder)
	return callback:InvokeServer()
end

The CanUseDialogue RemoteFunction is created at runtime, so when the plugin loads the module in Edit mode, it doesn’t exist, causes an infinite yield, and the dialogue editor never opens. If I change the code to the following, the infinite yield does not occur:

return function(player, dialogueFolder)
	local callback = game:GetService("ReplicatedStorage"):WaitForChild("CanUseDialogue")
	return callback:InvokeServer()
end

It seems the module is just loaded and the callbacks aren’t invoked themselves, but by loading the module anything that isn’t in the returned function is executed.

I don’t know why the modules are being loaded because they’re not being checked for correctness (i.e. I can change them to return nil and the editor loads fine). If there’s no particular reason why the modules are being loaded, then it’d be nice if they weren’t.

2 Likes

Ah, an interesting problem. I’ll add this to my list.

1 Like