I have a part in Workspace named Part and inside it is a script, I want that script to on touched get the player's name that has just touched the part and put their name in a GUI
local playername = game.StarterGui.checkinGui.mainFrame.playerName
local plrname = game.Players.LocalPlayer
function onTouch()
playername = plrname.Name
end
script.Parent.Touched:connect(onTouch)
Using a normal Script btw, not a LocalScript.

5 comments
Well what do I put then?
https://scriptinghelpers.org/blog/common-mistakes#PlayerGui
http://wiki.roblox.com/index.php?title=API:Class/Players/LocalPlayer
Wiki Description: "This property is client-side only! You should use a LocalScript instead of a Script when using it."
I would use a local script to do this, and then fire a server event the changes the name, and then it already has the value of player in the server script.