title: Roblox Error with 'attempt to index nil with `GetRankInGroup`'
body: <p>I am making a ChalkBoard that runs a presentation. When you click a button on the SurfaceGUI, it should be playing a presentation. The presentation function works. However, when it checks its player ranks, it will say the error (in the title). I know that <code>game.Players.LocalPlayer</code> can only be used in LocalScripts. But I instead used <code>(function(player)</code> because I thought that was the only way it would work. This could be a bit hard to understand, so I'll take some pictures of the errors and script.</p>
  <pre><code>local groupid = 6554102
  
  
  local rankid = 205
  
  
  local wait_time = 5
  
  
  local faces_text = {
      first = &quot;Left, Face - Turn left 90 degree&quot;;
      second = &quot;Right, Face - Turn right 90 degrees&quot;;
      third = &quot;About, Face - Turn 180 degrees&quot;;
      fourth = &quot;Left, Incline - Turn left 45 degrees&quot;;
      fifth = &quot;Right, Incline - Turn right 45 degrees&quot;;
      sixth = &quot;Control, eyes - Follow the host using your eyes&quot;;
      seventh = &quot;Center, Face - Face the host&quot;;
  }
  
  
  local rules_text = {
      first = &quot;1. Soldiers never abuse guns, guns are only for combat, using guns for other reasons or abusing will result in being arrested.&quot;;
      second = &quot;2. Soldiers never let civilian's trespass, only allied personnel are allowed into base.&quot;;
      third = &quot;3. Only go into your divisions area, never into other division's areas.&quot;;
      fourth = &quot;4. Never go into places your not suppose to go into unless authorized to.&quot;;
      fifth = &quot;5. Tanks, trucks, and halftracks are for combat or for driving long distances only.&quot;;
  }
  
  
  local ranks_text = {
      first = &quot;[PVT] Private&quot;;
      second = &quot;[LCPL] Lance Corporal&quot;;
      third = &quot;[CPL] Corporal&quot;;
      fourth = &quot;[SGT] Sergeant&quot;;
      fifth = &quot;[SSGT] Staff Sergeant&quot;;
      sixth = &quot;[SGT-MAJ] Sergeant Major (Obtainable by Gamepass)&quot;;
      seventh = &quot;[OCAD] Officer Academy Cadet &quot;;
      eight = &quot;Allied Personnel (BSM Diplomats)&quot;;
      ninth = &quot;[LT] Lieutenant&quot;;
      tenth = &quot;[CPT] Captain&quot;;
      eleventh = &quot;[MAJ] Major&quot;;
      twelth = &quot;[LTCOL] Lieutenant Colonel&quot;;
      thirteenth = &quot;[COL] Colonel&quot;;
      fourteenth = &quot;[GS] General Staff&quot;;
      fifteenth = &quot;[FM] Field Marshal&quot;;
      sixteenth = &quot;[PM] Prime Minister&quot;;
      seventeenth = &quot;[GG] Governor General&quot;;
      eighteenth = &quot;[HM] His Majesty&quot;;
  }
  
  
  local board = script.Parent
  local ChalkGUI = board.ChalkGui
  local StartFrame = ChalkGUI.StartFrame
  local FacesFrame = ChalkGUI.FacesFrame
  local RulesFrame = ChalkGUI.RulesFrame
  local RanksFrame = ChalkGUI.RankFrame
  local buttons = StartFrame.buttons
  
  buttons.faces.MouseButton1Click:Connect(function(player)
      if player:GetRankInGroup(groupid) &gt;= rankid then
      
      StartFrame.Visible = false
      
      FacesFrame.Visible = true
      
      FacesFrame.text.Text = faces_text.first
      
      wait(wait_time)
      
      FacesFrame.text.Text = faces_text.second
      
      wait(wait_time)
      
      FacesFrame.text.Text = faces_text.third
      
      wait(wait_time)
      
      FacesFrame.text.Text = faces_text.fourth
      
      wait(wait_time)
      
      FacesFrame.text.Text = faces_text.fifth
      
      wait(wait_time)
      
      FacesFrame.text.Text = faces_text.sixth
      
      wait(wait_time)
      
      FacesFrame.text.Text = faces_text.seventh
      
      wait(wait_time)
      
      FacesFrame.Visible = false
      
      StartFrame.Visible = true
      else
          
      end
  end)
  
  buttons.ranks.MouseButton1Click:Connect(function(player)
      if player:GetRankInGroup(groupid) &gt;= rankid then
      
      StartFrame.Visible = false
      
      RanksFrame.Visible = true
      
      RanksFrame.text.Text = ranks_text.first
      
      wait(wait_time)
      
      RanksFrame.text.Text = ranks_text.second
      
      wait(wait_time)
      
      RanksFrame.text.Text = ranks_text.third
      
      wait(wait_time)
      
      RanksFrame.text.Text = ranks_text.fourth
      
      wait(wait_time)
      
      RanksFrame.text.Text = ranks_text.fifth
      
      wait(wait_time)
      
      RanksFrame.text.Text = ranks_text.sixth
      
      wait(wait_time)
      
      RanksFrame.text.Text = ranks_text.seventh
      
      wait(wait_time)
      
      RanksFrame.text.Text = ranks_text.eight
      
      wait(wait_time)
      
      RanksFrame.text.Text = ranks_text.ninth
      
      wait(wait_time)
      
      RanksFrame.text.Text = ranks_text.tenth
      
      wait(wait_time)
      
      RanksFrame.text.Text = ranks_text.eleventh
      
      wait(wait_time)
      
      RanksFrame.text.Text = ranks_text.twelth
      
      wait(wait_time)
      
      RanksFrame.text.Text = ranks_text.thirteenth
      
      wait(wait_time)
      
      RanksFrame.text.Text = ranks_text.fourteenth
      
      wait(wait_time)
      
      RanksFrame.text.Text = ranks_text.fifteenth
      
      wait(wait_time)
      
      RanksFrame.text.Text = ranks_text.sixteenth
      
      wait(wait_time)
      
      RanksFrame.text.Text = ranks_text.seventeenth
      
      wait(wait_time)
      
      RanksFrame.text.Text = ranks_text.eighteenth
      
      wait(wait_time)
      
      RanksFrame.Visible = false
      
      StartFrame.Visible = true
      else
          
      end
  end)
  
  buttons.rules.MouseButton1Click:Connect(function(player)
      if player:GetRankInGroup(groupid) &gt;= rankid then
      
      StartFrame.Visible = false
      
      RulesFrame.Visible = true
      
      RulesFrame.text.Text = rules_text.first
      
      wait(wait_time)
      
      RulesFrame.text.Text = rules_text.second
      
      wait(wait_time)
      
      RulesFrame.text.Text = rules_text.third
      
      wait(wait_time)
      
      RulesFrame.text.Text = rules_text.fourth
      
      wait(wait_time)
      
      RulesFrame.text.Text = rules_text.fifth
      
      wait(wait_time)
      
      RulesFrame.Visible = false
      
      StartFrame.Visible = true
      else
          
      end
  end)
  </code></pre>