How do I detect if a dialogue option is clicked?

You know roblox’s built in ncp dialogue system, I want to make it so a script senses if an option is clicked. Is this possible?

Edit: I figured it out, the dev hub said that the thing needs a local script, cause it returns the player in the script. So I just placed it in starter player scripts and it worked.

1 Like

This might be what your looking for, but you might just be better off making your own dialogue system

Dialog.DialogChoiceSelected (roblox.com)
The link says it won’t fire on the server btw

1 Like

Ye uh late reply. Sorry.
I did this, yet it doesn’t print… There are no errors.



local cool = script.Parent

cool.DialogChoiceSelected:connect(function(player)
	print("Works")
end)

“cool” is the dialog option

well to be fair i dont work with dialog so i have no idea, but there is a second parameter, which is the dialog choice. you might need to put a string or a path if the dialogchoice is a object or if its a property then you’d probably do Dialog.DialogChoice

1 Like

You could try use Click Detector

1 Like

idk if that would work and i just tried doing this:

local clickDetector = script.Parent.ClickDetector

function onMouseClick()
	print("You clicked me!")
end

clickDetector.MouseClick:connect(onMouseClick)

And it didnt work

DialogChoiceSelected only works on a Dialog, not a DialogChoice.


dialog.DialogChoiceSelected:connect(function(player, choice)
	if choice == cool then
        print("cool")
    end
end)
1 Like

Did you used a Local Script? Click detector don’t work with local Script but you can Use a script and a remote event that will Fire The Client with the information and use

YourRemoteEvent.OnClientEvent:Connect(function()
    print("You clicked me!")
end)