One tool per map

hi!
I have a proximity prompt which gives player a tool and than has a cooldown, I would like to remake in a way that once the tool is taken it will not respawn until its parent is “Dropped Items” (Folder where all dropped items in my game go). If it will be in dropped items for 10 minutes (600 seconds) it should respawn back in the tool giver.

How can I do that?

Maybe something like GetPropertyChangedSignal(“Parent”)
Then task.wait()
Then function Respawn()

I have used a function from your suggestion and I made the system work with my custom dropping item system. I will provide the script below and write explanation to it in case someone will need similar code.

local FakeSCP = script.Parent.FakeSCP --SCP Model on display
local Prompt = script.Parent.ProximityPrompt -- Prompt
local Working = false 

Prompt.Triggered:connect(function(Player)
	if FakeSCP.Transparency == 0 and  Player and Player.Character then --Checks is the object taken or not
		print("SCP-005 has been picked up by a player")
		Working = true
		FakeSCP.Transparency = 1 --hides the model to indicate that the object is taken
		local Backpack = Player:WaitForChild("Backpack") 
		local Tool = game.ServerStorage:FindFirstChild("SCP-005"):Clone() --Duplicate the tool
		Tool.Parent = Backpack -- Gives the item in to the players inventory
		wait(1)
		Working = false
		Tool:GetPropertyChangedSignal("Parent"):Connect(function() --Detects Property "Parent" changed
			if Tool == nil 
				or Tool.Parent == nil 
				and not (Working) then
				print("Restarting position of SCP-005") --if all requierments are meet object respawns at its place
				Tool:Destroy()
				FakeSCP.Transparency = 0
			end	
		end)
	elseif Player and Player.Character then
		local playersSCP = Player.Character:FindFirstChild("SCP-005")
		if playersSCP ~= nil then --if player has the object in their hand and interact with the table which object is usually placed on the SCP is getting destroyed and goes to line "Tool:GetPropertyChangedSignal("Parent")"
			print("SCP-005 has been placed back by a player")
			playersSCP:Destroy()
		end
	end
end)

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