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?
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
-- ...
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