Dialog script not giving tool

Hello everyone my dialog script is supposed to give me a tool when the dialog is selected
which doesnt work
It’s not printing anything in the output and not underlining mistakes could you help me?

Script:

local rs = game:GetService("ReplicatedStorage")
local juice = rs:WaitForChild("Juice")

script.Parent.DialogChoiceSelected:Connect(function(player, Dialog)
	if Dialog.Name == "Juice" then
		if player.Backpack:FindFirstChild('Juice') == nil then
			juice:Clone().Parent = player.Backpack
			print("Juice Collected")
		end
	end
end)

The only thing I can think of, try printing out the name of Dialog and seeing if it prints ‘Juice’ or something different.

You could also make sure ‘Juice’ exists in ReplicatedStorage as well; getting rid of the possibility of a typo.

There is a Juice in the replicatedstorage
And i tried printing the dialog name

local rs = game:GetService("ReplicatedStorage")
local juice = rs:WaitForChild("Juice")

script.Parent.DialogChoiceSelected:Connect(function(player, Dialog)
	print(Dialog.Name)
	if Dialog.Name == "Juice" then
		if player.Backpack:FindFirstChild('Juice') == nil then
			juice:Clone().Parent = player.Backpack
		end
	end
end)

It printed nothing, let me show where the script is located
2443eefa6c6e38c5306e3cea616a9023

IIRC you have to use Dialog instances from LocalScripts. (despite the wiki “disagreeing”)

1 Like

Can you explain what you said?