Help with Dialog Choice Script

I am trying to make a script where if the player selects a certain choice, they die. The script doesn’t work, there are no errors and it doesn’t print anything.

Script:

local Dialog = script.Parent

Dialog.DialogChoiceSelected:Connect(function(Player, Choice)
	print(Player, Choice)
	if Choice.Name == "What are you going to do?" then
		Player.Character.Humanoid.Health = 0
	end
end)
1 Like

The script should be a local script because DialogChoiceSelected only fires on the client and not on the server. So make it local script and also change the local Dialog variable to the new path

Thank you! The Dialog page of the DevHub never specified whether I needed a Script or a LocalScript.

It actually does:

https://developer.roblox.com/en-us/api-reference/event/Dialog/DialogChoiceSelected

I looked on this page: NPC Dialog Boxes (roblox.com)

You could’ve just clicked on the link at the start where it shows the reference for the DialogChoiceSelected, but whatever it’s fixed either way