My script doesn't have errors but still doesn't work

So I have this whole quest thing going on in my game and I created a simple script where when a specific dialog choice is selected the script will check if the selected choice is the dialog choice It needs ( aka the dialog choice that allows the game to progress ) and if it does it prints a string.

However, my script doesn’t have any errors it just skips the function.
I have a feeling that my script works perfectly fine but I have miss-used the DialogChoiceSelected function.

--Variables
local Dialog = script.Parent
local DialogChoice = Dialog.DialogChoice

-- Function is run ( checks if the selected choice was dialog choice )
Dialog.DialogChoiceSelected:Connect(function(SelectedChoice)
	if SelectedChoice == DialogChoice then
		print("Quest Activated")
	end
end)
2 Likes

I have tried printing but to no avail.

1 Like

There are 2 arguments to the .DialogChoiceSelected; player and choice right now you have the player set to SelectedChoice. You should put:

Dialog.DialogChoiceSelected:Connect(function(Player, SelectedChoice)
	if SelectedChoice == DialogChoice then
		print("Quest Activated")
	end
end)
2 Likes

This makes sense but I still have the same problem.

show me more of the script, I can’t really detect the problem if you only show a small portion, cause the problem could be on a different part

That’s the whole script though.

i’m pretty sure that dialog choice is not what you think then; So the print doesn’t fire because SelectedChoice will never equal DialogChoice

Oh I see, I am having trouble finding what the second parameter means I haven’t been able to find any info about it though.

I found the problem, the DialogChoiceSelected function cannot run in a regular script, instead it has to be in a localscript and must be parented to the StarterPlayerScripts folder For some reason that I am un aware of

1 Like