In my code I have a door, when click it shows there player name on the door and lets them go through it. Right now it doesn't work in multiplayer but it will run in test mode. It currently passes (player) from a local script.
door = game.Workspace.Door88
game.Workspace.Doors.Door88Event.OnServerEvent:Connect(function(player)
if game.Players.LocalPlayer.PlayerGui.Values.DoorCheck.Value == false then
if door.Owner.Value == "Unowned" then
door.Owner.Value = player.Name
door.SurfaceGui.Owner.Text = door.Owner.Value
game.Players.player.Name.PlayerGui.Values.DoorCheck.Value = true
end
elseif game.Players.player.Name.PlayerGui.Values.DoorCheck.Value == true then
if door.Owner.Value == player.Name then
door.Owner.Value = "Unowned"
door.SurfaceGui.Owner.Text = "Unowned"
game.Players.player.Name.PlayerGui.Values.DoorCheck.Value = false
else
print("Door Owned")
end
end
end)
I was wondering how I would be able to change LocalPlayer in line 4 to get a players name. Any suggestions. Thanks.

2 comments
player in the parameter is what should be used, don't do game.Players.LocalPlayer since that only used in local script (LocalPlayer) .
user = game.Players:findFirstChild(Tool.Parent.Name) if ur good at scripting try making this into whenver u click the door