NPC Shop dialogue doesnt work

I want to make an NPC dialogue that gives you a tool when you interact with a dialogchoice. For me it seemed like a simple localscript, but it just doesn’t work. I’ve tried adding a print(player.Name) to debug it but it doesnt print meaning it doesnt fire the function at all. What am I doing wrong?

Localscript:

local tool = game:GetService("ReplicatedStorage"):WaitForChild("Bloxy Cola")

script.Parent.DialogChoiceSelected:Connect(function(player, choice)
	if choice.Name == "Bloxy Cola" then
	tool:Clone().Parent = player.Backpack
	end
end)

image

LocalScripts do not run outside of specific container services.

Try changing it to a Script with RunContext set to Enum.RunContext.Client.

Woah, that did the job. Thanks!

Do note that cloning the tool on the client will cause a desynchronization, as the tool isn’t on the server.

If this behavior isn’t desired then you’ll need to change it to be handled on the server.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.