Roblox Backpack with Limits:

Hello there!

I would like to know If there is a possibility to have your Roblox StarterPack with the limit to handle one tool whenever the Player grabbed by using ClickDetector or ProximityPrompt.

If yes, can anybody help me with how I can manage to do so? I know it quite can sound a bit silly, though, I am unfortunately quite not good at understanding deeply Lua, except for the basics such as game.Workspace.JuanGamerPlayz_RBLX.Humanoid.WalkSpeed = 150.

I appreciate the help. Thank you! :pray:

Proximity Prompt:

script.Parent.Triggered:Connect(function(plr)
	local tool = game.ServerStorage.Tool:Clone()
	local toolFound = plr.Backpack:FindFirstChild("Tool") or (plr.Character and plr.Character:FindFirstChildWhichIsA("Tool") and plr.Character:FindFirstChildWhichIsA("Tool").Name == "Tool")
	if toolFound then
		toolFound:Destroy()
	end
	Tool.Name = "Tool"
	Tool.Parent = plr.Backpack
end)

Click Detector:

script.Parent.MouseClick:Connect(function(plr)
	local tool = game.ServerStorage.Tool:Clone()
	local toolFound = plr.Backpack:FindFirstChild("Tool") or (plr.Character and plr.Character:FindFirstChildWhichIsA("Tool") and plr.Character:FindFirstChildWhichIsA("Tool").Name == "Tool")
	if toolFound then
		toolFound:Destroy()
	end
	Tool.Name = "Tool"
	Tool.Parent = plr.Backpack
end)
1 Like

Is it okay If I insert it like this for ProximtyPrompt:

(The script was made by a developer helping me out with the ProximityPrompt system)

local tool = script.Parent
local handle = script.Parent.Handle
handle.TouchInterest:Destroy()

if tool.Parent == workspace then
	local proximtyprompt = Instance.new("ProximityPrompt")
	proximtyprompt.Parent = handle
	proximtyprompt.KeyboardKeyCode = Enum.KeyCode.E
	proximtyprompt.ActionText = "Grab Item"
	proximtyprompt.HoldDuration = 0.1

	proximtyprompt.Triggered:Connect(function(Player)
		local backpacl = Player:WaitForChild("Backpack")
		tool.Parent = backpacl
		proximtyprompt:Destroy()
	end)
end

script.Parent.Triggered:Connect(function(plr)
	local tool = game.ServerStorage.Tool:Clone()
	local toolFound = plr.backpacl:FindFirstChild("Tool") or (plr.Character and plr.Character:FindFirstChildWhichIsA("Tool") and plr.Character:FindFirstChildWhichIsA("Tool").Name == "Tool")
	if toolFound then
		toolFound:Destroy()
	end
	tool.Name = "Tool"
	tool.Parent = plr.backpacl
end)
local tool = script.Parent
local handle = script.Parent.Handle
handle.TouchInterest:Destroy()

if tool.Parent == workspace then
	local proximtyprompt = Instance.new("ProximityPrompt")
	proximtyprompt.Parent = handle
	proximtyprompt.KeyboardKeyCode = Enum.KeyCode.E
	proximtyprompt.ActionText = "Grab Item"
	proximtyprompt.HoldDuration = 0.1

	proximtyprompt.Triggered:Connect(function(plr)
	local toolFound = plr.backpack:FindFirstChild("Tool") or (plr.Character and plr.Character:FindFirstChildWhichIsA("Tool") and plr.Character:FindFirstChildWhichIsA("Tool").Name == "Tool")
	if toolFound then
		toolFound:Destroy()
	end
	tool.Name = "Tool"
	tool.Parent = plr.backpack
	end)
end

Something like this, lmk if there are any errors.

Sorry for the late response but I would like to tell you that I tested the script in two tools (wrench and a key) but none of them went into my StarterPack, only could appear the ProximityPrompt:

Any errors? This text will be blurred

Not having the possibility to pick up the tool, yes. But as for the Client/Server on Developer Console, no.

I found this maybe check it out:

I tested it out and the problem is that it only captures tools that contain TouchInterest. Also, whenever you equip and stop holding the tool, it disappears in your inventory, which is quite strange…

Are you trying to make it so your player can only have one tool in their backpack at a time? if so then you can just get the length of the table of their backpack and if it’s higher than your max then don’t give the tool