I can't figure out why the code isn't running, it is inside a local script.

local dialog = workspace["Test SellNPC"].Head.Dialog


local function sellgold(player, choice)
	print("gold sold")
end


dialog.DialogChoiceSelected:Connect(sellgold)

4 comments

0

Where is the script located?

0

ServerScriptService

1

Ah, that is your issue. Localscripts cannot run in Serverscriptservice. I'd suggest putting it inside of StarterPlayerScripts, where localscripts can be run.

0

worked, ty