Check if tool is Equipped

Hey guys, im going insane.

I used to have a System for Cooking where the Game checks if the Player has the Item in the Inventory, when he Equips it he Enabled a Proximity Promt.

I want the same System for a Suitcase and a Wardrobe but it, for the love of god, dosent want to work.

I have a Local Script and a Script inside the Promt.

I just need a Simple check if the tool is equiped and that Enabled the Prox. Can someone shine a light in what i do wrong? :,(

MASSIVE THANKS

2 Likes

Could you please show the script, otherwise we can’t see whats wrong with it.

I can give you the Working Code from the Cooking ones.

THIS ONE IS IN THE STARTER PACK:

 local player = game.Players.LocalPlayer
local toolName = "PlateWithSteak"  

 local backpack = player:WaitForChild("Backpack")
 local character = player.Character or player.CharacterAdded:Wait()

local proximityPrompt = workspace.PlacementOne.PlateWithSteakProx 
local tool = backpack:FindFirstChild(toolName)

 local function updatePrompt()
	if tool and character:FindFirstChild(toolName) then
		proximityPrompt.Enabled = true
 	else
 		proximityPrompt.Enabled = false
 	end
 end

 updatePrompt()
 
 character.ChildAdded:Connect(function(child)
 	if child.Name == toolName then
 		tool = child
 		updatePrompt()
 	end
 end)
 
 character.ChildRemoved:Connect(function(child)
	if child == tool then
 		tool = nil
 		updatePrompt()
 	end
 end)
 
 proximityPrompt.Triggered:Connect(function()
 	if tool then
 		tool:Destroy()
 	end
 end)

AND THIS ONE IS IN THE PROXIMITY PROMT:

 local ProximityPrompt = script.Parent -- Adjust this to the actual path of your ProximityPrompt
 local ToolName = "PlateWithSteak"
 

 local modelToClone = game.ServerStorage.PlateWithSteakModel

local spawnPosition = Vector3.new(-50.3, 2.45, 13.35) 

 
 local function checkForToolEquipped(player)
 	local character = player.Character
 	if character then
 		local tool = character:FindFirstChild(ToolName)
 		if tool then
 			local clonedModel = modelToClone:Clone()
			clonedModel.Parent = game.Workspace
			clonedModel:SetPrimaryPartCFrame(CFrame.new(spawnPosition))
			-- Set the PrimaryPart
			clonedModel.PrimaryPart = clonedModel:FindFirstChild("Plate")  -- 

			
 			print("Player has the tool Plate with Steak equipped.")

		end
	end
 end
 
 game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
 		checkForToolEquipped(player)
 	end)
 end)
 
 ProximityPrompt.Triggered:Connect(function(player)
 	checkForToolEquipped(player)
 end)

What i want is Just that the Game Knows when the Tool Names “Suitcase” is Equiped and the Promt gets Enabled and when the Promt is triggered the Second script just removes the Tool.

I tried re writing the code but i always end up with a Infinite Yield or a Nil

Like said the Code works fine for its original Purpose which was checking if the player had a Plate in Equiped and the Plate then got Cloned to a Specific spot on a table and the item was destroyed out of the players inventory.

Why can’t you just show the one you’re working with?

If there IS ONE i would show one.
Hence why i explained it several times. Hope that clears it up a bit.

function CheckTool(Char)
if Char:FindFirstChildWhichIsA("Tool") then return true else return false end end
1 Like

Use Tool.Equipped Function

1 Like