DialogChoiceSelected is not a valid member of DialogChoice

I am getting this error, DialogChoiceSelected is not a valid member of DialogChoice.

local players = game:GetService("Players")
local localPlayer = players.LocalPlayer
local replicated = game:GetService("ReplicatedStorage")
local footlongremote = replicated:WaitForChild("SabwayFootlong")

local worker = workspace:WaitForChild("Sabway Worker")
local workerHead = worker:WaitForChild("Head")
local workerDialog = workerHead:WaitForChild("Dialog")
local dialogChoice = workerDialog:WaitForChild("order")
local footlongchoice = dialogChoice:WaitForChild("footlong")
local sixinchchoice = dialogChoice:WaitForChild("sixinch")
local saladchocie = dialogChoice:WaitForChild("salad")
local wrapchoice = dialogChoice:WaitForChild("wrap")

footlongchoice.DialogChoiceSelected:Connect(function(player, choice)
	if player == localPlayer then
		if choice == footlongchoice then
			footlongremote:FireServer()
		end
	end
end)

These are my properties,
image

I am pretty sure it is because it only works with a Dialog but not DialogChoices but it’s weird, since the function is “DialogChoiceSelected”. Though, is there a solution?

1 Like

When a DialogChoice instance is selected its Dialog ancestor’s DialogChoiceSelected RBXScriptSignal is fired.

workerDialog.DialogueChoiceSelected:Connect(function(player, dialogChoice)
	if dialogChoice == footlongchoice then
		--Do code.
	end
end)
2 Likes