How do you make events occur after selecting a dialogchoice?

After only a solid 3 hours of read time, I have been able to access posting :grin:. I am new with scripting and I have absolutely no idea what i’m doing. I wanted to make a model spawn on top of a player after they selected a DialogChoice. As a newbie of course, I went to use ChatGPT for a script and it wasn’t worth the 5.3 hour trial and error session I had with it. I still haven’t figured out how to do it and I am having insane amounts of trouble with getting this item to spawn. I have a better game idea in mind and I wanted to use this mechanic as some sort of hidden “easter egg” type thing. But I was wondering if anyone was willing to explain this down for me so I can understand what i’m actually doing. Thank you :pray:t6:

1 Like

Refer to official documentation https://create.roblox.com/docs/reference/engine/classes/Dialog#DialogChoiceSelected

local dialog = script.Parent

local function onChoiceSelected(_player, _choice)
	-- Write your logic here
end

dialog.DialogChoiceSelected:Connect(onChoiceSelected)
2 Likes

This event is client-side only and will not fire on the server so that you need to use remote event.

1 Like