Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How come "FindFirstChild" doesn't work when a tool is equipped?

Asked by 5 years ago

I've been working on code for ROBLOX, where the player is checked if they have an item. I use the code: local tool = player.Backpack:FindFirstChild("Tool") if tool == nil then print("Player does not have tool") else print("Player has tool") end

But whenever the player has the tool equipped, the code returns nil. Can someone help me with this? Thanks.

1 answer

Log in to vote
0
Answered by
poke7667 142
5 years ago
Edited 5 years ago

When a Tool is equipped, it's Parent becomes the Player's character. Check for workspace instead or use the Equipped function and the Unequipped function.

0
Equipped is not a function, neither is Unequipped. They are events. User#19524 175 — 5y
Ad

Answer this question