Hello, I’m trying to get a player username when they touch a part. I haven’t seen this question on the forums.
I want it to be server sided.
I’m not that good of a scripter, so I don’t have anything right now.
Thanks!
1 Like
Then to get the Username do player.Name
local Players = game:GetService("Players")
local part = workspace.Baseplate --the part you want to be touched
part.Touched:Connect(function(hit)
local player = Players:GetPlayerFromCharacter(hit.Parent)
if player then
local name = player.Name --got name
print(name)
end
end)
if you want it to fire once you need to add a debounce
7 Likes