I'm making a door that teleports up/down when a button is clicked and making it group rank specific. The error in the output I'm getting is Workspace.Module1.Model.ButtonOpen.Module1Open:8: attempt to index nil with 'GetRankInGroup'
can someone help me figure out what I'm doing wrong?
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.ButtonOpen.ClickDetector.MouseClick:Connect(function(click)
if Players:FindFirstChild(click.Parent):GetRankInGroup(5339051) > 7 then
Door1:MoveTo(Vector3.new(-38.59, 1, -17.925))

1 comment
Thank you, everyone! I appreciate the answers :)