Hello. I am trying to write a piece of code that allows a player to edit their overhead gui. This particular function concerns the player's ability to toggle on/off the name.
On line 6, there may be an error if the user has not yet entered a name. If they have not, an error shows if they try to toggle their name back on. "(string expected, got nil)"
Obviously, I tried to rectify that on the next elseif statement, but the program stops reading at the error.
Is there any way to get past this?
remote.OnServerEvent:Connect(function(Player) if comClone.Data.Text == nameEntered or comClone.Data.Text == Player.Name then comClone.Data.Text = "" elseif comClone.Data.Text == "" then comClone.Data.Text = nameEntered elseif nameEntered == nil then comClone.Data.Text = Player.Name end end)