So I just started scripting one week ago and I want to start using this. What I wanted to do is make it print the person's name that is equipping a tool on the output. Here is the script:
local Players = game:GetService("Players")
local tool = script.Parent.Parent
local function Equipped(a)
local player = Players:GetPlayerFromCharacter(a.Parent)
if not player then return end
print(player.Name)
end
tool.Equipped:Connect(Equipped)
However, when I equip the tool, it doesn't work. Can someone please help me and teach me how to fix it? Thanks!

3 comments
There isn't a need for this method in such a scenario. Just use the LocalPlayer.
Ok thanks!
If it's already solved, just put [Solved] in the title to let others know it's already been answered