I have a Dialog object and I placed a script inside of it. The snippet that won’t fire is below:
script.Parent.DialogChoiceSelected:Connect(function (plr, dialog)
if workspace.Status.npcActionDone.Value == true then
workspace.Status.npcActionDone.Value = false
wait(3)
local module = require(game.ReplicatedStorage.NPCModule)
local npc = module.spawnRandomFriend(plr)
module.AddDialogueToPerson(npc)
script.Parent.Parent.Parent:Destroy()
end
end)
This won’t even print an error, it just think it doesn’t fire because of this.
Expected behavior
It should delete the NPC and spawn a new one with NPCModule:
script.Parent.DialogChoiceSelected:Connect(function (plr, dialog)
if workspace.Status.npcActionDone.Value == true then
workspace.Status.npcActionDone.Value = false
wait(3)
local module = require(game.ReplicatedStorage.NPCModule)
local npc = module.spawnRandomFriend(plr)
module.AddDialogueToPerson(npc)
script.Parent.Parent.Parent:Destroy()
end
end)