This is a Server Script
local part = script.Parent
--player--
local Player = game:GetService("Players").LocalPlayer
local PlayerName = Player.Name
part.Touched:Connect(function(touch)
if touch.Parent:FindFirstChild("Humanoid") then
print(PlayerName)
end
end)

1 comment
thats a regular script and LocalPlayer doesn't exist in a regular script. Another thing is that the PlayerName won't print who touched the part.