Help with path giver

I am making one of those path givers that you can find in those easy obbies. They work like intended but there’s one problem. When I step on a part it gives me the path and it works find but when I step on the part again it gives me another path.

How do I make it so that the part I step on only gives me one path instead of multiple. I don’t want it to give me the same path every time I step on the part I just want it to give me the path once until I die and don’t have it anymore…

Script:

local db = false
script.Parent.Touched:Connect(function(hit)
	local hum = hit.Parent:FindFirstChild("Humanoid")
	if hum then
		local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
		if plr and not db then
			db = true
			local newpath = script.Parent:FindFirstChildOfClass("Tool"):Clone()
			newpath.Parent = plr.Backpack
			wait(1)
			db = false
		end
	end
end)

check if the players backpack or character has the tool in it, replace ToolName with the name of your tool.

local db = false
script.Parent.Touched:Connect(function(hit)
	local hum = hit.Parent:FindFirstChild("Humanoid")
	if hum then
		local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
		local tool = plr.Backpack:FindFirstChild("ToolName") or plr.Character:FindFirstChild("ToolName")
		if plr and not db and not tool then
			db = true
			local newpath = script.Parent:FindFirstChildOfClass("Tool"):Clone()
			newpath.Parent = plr.Backpack
			wait(1)
			db = false
		end
	end
end)
2 Likes

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