Check if player is holding a specific tool

How do i check if player is holding a tool called “Almond Water” for example. If yes then it will print(“Holding Almond Water”), If not then print(“Not holding almond water”)

FYI : I have searched this problem up but nothing seems to work. Can someone please explain the code afterwards if possible?

2 Likes

If a tool is equipped, it will be in the player character. You can check it like this:

local Tool = Path.To["Almond Water"]
local function CheckHoldingTool()
	if Tool.Parent == Player.Character then
		print("Holding Almond Water")
	else
		print("Not holding Almond Water")
	end
end

Alternatively you could use the name:

if Player.Character:FindFirstChild("Almond Water") then
	-- ...
2 Likes
local Player = game.Players.LocalPlayer

local function IsToolEqupided(ToolName: string): boolean
	local IsTool = Player.Character:FindFirstChildOfClass("Tool")

	if IsTool and IsTool.Name == ToolName then
		return true
	else
		return false
	end
end

1 Like

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