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!
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)