Help with Proximity Prompt Quest Script

I am trying to make it so that if you complete the objective and have a tool in your inventory and you talk to an npc your quest is finished.

I’m using a similar NPC GASA4 code, but this is the code for the npc

local GUI = script.Parent.Parent.Parent.Head.BillboardGui
local dialogue = GUI.Frame.Dialogue.Text
local DialogueSound = script.Parent.Parent.Parent.Head.Talk
local mail = game.Workspace.Mail
local play = game.Players
canTalk = true
-- activates dialogue based on certain situations

script.Parent.Triggered:Connect(function(player)
	if canTalk == true then
		script.Parent.Enabled = false
		talk("Yo lil bro, I'm too lazy to get the mail, can you do it for me?", 0.035)
		talk("..Or I'll tell dad that you've been sneaking out at night.", 0.035)
		script.Parent.Enabled = true

		end
	end)

function talk (text, speed)
	canTalk = false
	GUI.Enabled = true

	for i = 1, text:len() do
		if text:sub(i,i) ~= "" then
			DialogueSound:Stop()
			DialogueSound:Play()
		end

		local c = text:sub(1,i)
		GUI.Frame.Dialogue.Text = c
		wait(speed)
	end

	wait(3)
	GUI.Enabled = false
	canTalk = true
end
2 Likes