Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Attempt to index nil with "GetRankInGroup"?

I'm making a door that teleports up/down when a button is clicked and making it group rank specific. I'm getting an error message in the output "Workspace.Module1Close:10: attempt to index nil with 'GetRankInGroup'"

Here is my script:

game.Players.PlayerAdded:Connect(function(player) end) Part = script.Parent Door1 = game.Workspace:WaitForChild("Door1")

workspace.Module1.Model.ButtonClose.ClickDetector.MouseClick:connect(function(Player) if game.Players.LocalPlayer:GetRankInGroup(5339051) > 7 then wait(0) Door1:MoveTo(Vector3.new(-38.59, 12, -17.925))

end

end)

Any help would be appreciated!

1 comment

0

Line 7: ...............................................:Connect(function(click)

1 answer

✓ Accepted answer

This script might work, script:

local Players  =   game:GetService("Players")										  	 
local part = script.Parent                                                                                                                  
local Workspace = game:GetService("workspace") 									 
local Door1 = Workspace:WaitForChild("Door1")									 
local Click = .Workspace.Module1.Model.ButtonClose.ClickDetector									 			 
                                                                                                                                           
 Workspace.Module1.Model.ButtonClose.ClickDetector.MouseClick:Connect(function(click) 
   players:FindFirstChild(click.Parent):GetRankInGroup(5339051)                            
   if rank >7 then 
    Door1:MoveTo(Vector.new(-38.59, 12, -17.925)) 								            
  else 																			 
     print("Player rank is not higher than 7.")                                                          
    end 
  end)									 

1 comment

0

Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.