Hello there, @fouroul94 . I am not quite sure what you are trying to achieve, but you said you need to detect when player equips or unequips the tool, you can do this by
player.Character.ChildAdded:Connect(function(child)
if child:IsA("Tool") and child.Name=="Katana" then
----do what you want to do here such as,
print(player.Name)
end
end)
Though I really want to know what you are trying to achieve here, if you can explain?
Also, if you are new to lua, I can help you with the entire code, the one I gave you is to help you understand.
You mentioned equipped/unequipped. Its okay though,
If you want to detect when the tool is added to Backpack of the player, you can replace the player.Character.ChildAdded with backpack.ChildAdded
Though if you want to do this in a different way, I wouldn’t recommend you using while loop.
You can maybe use, repeat wait() until backpack:FindFirstChild("Katana")
As you said the tool is in the starterpack, there’s no doubt in it not being added to the player’s backpack.
Hope this helps.
Make sure you are using .PlayerAdded event, and that player is defined in the function,
if you can provide the whole code(if it isn’t too long) that would be better for me to help you.