@Sniperkaos is correct, it needs to be inside a local script since the tool is client-sided and localised. Any code inside the function should be aimed for client-sided use also, so make sure your code inside the function is working. As @ElusiveEpix said, you should put some print statements inside the function to test if the function itself works before working on the code inside the function. Good luck!
theres another way i was having the same problem and saw your post that it requires the handle, But if you set HandleRequired property to false it works
function AncestryChanged()
if not game.Players:GetPlayerFromCharacter(Tool.Parent)then
return
end
-- my code here
end
Tool.AncestryChanged:Connect(AncestryChanged)