Script isn't detecting dialog interaction

I’m trying to make an NPC using dialogs that increases a value and resets some values.
However, the script isn’t even detecting when the player opens the dialog at all.
This is the script that I have:

script.Parent.Dialog.DialogChoiceSelected:Connect(function(player, pick)
	print("reply")
	local stats = player:WaitForChild("leaderstats")
	local level = stats:WaitForChild("Level")
	local prestige = stats:WaitForChild("Prestige")
	if (pick == script.Parent.Dialog.PrestDialogChoice.Catch.Proceed1.Proceed2.Confirm) then
		print("attempting")
		local stats = player:WaitForChild("leaderstats")
		local level = stats:WaitForChild("Level")
		local tickets = stats:WaitForChild("Tickets")
		local exp = stats:WaitForChild("exp")
		local expr = stats:WaitForChild("expremaining")
		local prestige = stats:WaitForChild("Prestige")
		local pcredits = stats:WaitForChild("P-Credits")
		local multi = stats:WaitForChild("Multiplier")
		if level.Value >= (50 + (prestige.Value * 5)) then
			print("reqs met")
			pcredits.Value = pcredits.Value + ((20 + (level.Value - (50 + (prestige.Value * 5)))))
			multi.Value = multi.Value + ((math.floor(tickets.Value / 50000)) / 100)
			tickets.Value = 0
			level.Value = 1
			exp.Value = 0
			expr.Value = 1000
			local h = player.Parent:FindFirstChild("Humanoid")
			h.Health = 0
		end
	end
)

end)

None of the prints are triggered.
This is what it looks like in the directory:
image
Can anyone please tell me how I can get the script to detect when the player interacts with the dialog?

I tried to do something like this a while ago, it did not work on the server but it worked fine on the client
Maybe try something like this on a local script with security checks on the server

DIALOGPATHHERE.DialogChoiceSelected:Connect(function(p, instance)
	if p == game.Players.LocalPlayer then
       print("slay")
    end
end)

(Not 100% sure this will work, you can also add a check to make sure its a certain choice by checking the instance with an if instance == INSTANCE then statement)

1 Like