Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Attempt to index nil with "GetRankInGroup"?

Asked by 3 years ago

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!

0
Line 7: ...............................................:Connect(function(click) uiuiuiuihauahua67 15 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

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)                                   
0
Thanks! MissDawdle 4 — 3y
Ad

Answer this question