I have some blocks, that you can speak with they, and if you select a specific choice, the block must be destroy, I make an understandable extract of the code
LOCAL SCRIPT:
NOTE: this is a Local Script of a tool
local dialog = tool:WaitForChild("MaterialsDialog") --the dialog
local clonedDialog --a variable to clone the dialog
--this is the function to use the dialog
--and acctualy, this only call the server, and send the object
local function choiceFunction(choice, object)
if tostring(choice) == "Yes" then
exchangeWoodForMaterials:InvokeServer(object)
end
end
local function onEquip()
--NOTE: the getPlayerStuff:InvokeServer(), give the array of objects
for _, object in ipairs(getPlayerStuff:InvokeServer()) do
if object.Name == "PlainTable" then
--clone the dialog
clonedDialog = dialog:Clone()
--set the dialog to the object
clonedDialog.Parent = object
--set the interface to the dialog
clonedDialog.DialogChoiceSelected:connect(
function(_, choice)
choiceFunction(choice, object)
end)
end
end
end
SERVER SCRIPT
local exchangeWoodForMaterials = --new RemoteFunction
function exchangeWoodForMaterials.OnServerInvoke(player, object)
--get the price of the object
local price = buildingMotor:GetPrice(object.Name)
--give the player the price
managerDataStorage:ChangeStat(player, "Materials", price)
object:Destroy() --destroy the object
end
and, I got this error:
partOrCharacter must be in the Workspace
Stack Begin
Script 'CoreGui.RobloxGui.CoreScripts/MainBotChatScript2', Line 304 - upvalue chatFunc
Script 'CoreGui.RobloxGui.CoreScripts/MainBotChatScript2', Line 323 - global selectChoice
Script 'CoreGui.RobloxGui.CoreScripts/MainBotChatScript2', Line 348
Stack End
I need to stop the Dialog or destroy, acctualy, the Dialog it's going to be destroy anyway.
Any help will be appreciated.

2 comments
Can you include the script.
I am going to make an understandable extract