Greetings everyone, I’m new to the Devforum.
I want this script to detect an user’s Rank ID once clicked a button using ClickDetector, and if it’s 50 or higher, it lets them open/close the door.
So I tried this in a LocalScript and it worked but since it’s a LocalScript, it works for only that player → no point on opening/closing.
-- Y = Yellow
-- R = Red
-- C = Cyan
local clickdetectorY = game.Workspace.Temple_0.ButtonBox.DoNotTouchTheName.Buttons.YB.ClickDetector
local clickdetectorR = game.Workspace.Temple_0.ButtonBox.DoNotTouchTheName.Buttons.RB.ClickDetector
local clickdetectorC = game.Workspace.Temple_0.ButtonBox.DoNotTouchTheName.Buttons.CB.ClickDetector
local Player = game.Players.LocalPlayer
local GroupID = 8551076
local minimumRank = 50
clickdetectorY.MouseClick:Connect(function()
if Player:GetRankInGroup(GroupID) >= minimumRank then
if game.Workspace.Temple_0.EntryNeonDoor.Transparency == 1 then
game.Workspace.Temple_0.EntryNeonDoor.CanCollide = true
game.Workspace.Temple_0.EntryNeonDoor.Transparency = 0.7
else
game.Workspace.Temple_0.EntryNeonDoor.CanCollide = false
game.Workspace.Temple_0.EntryNeonDoor.Transparency = 1
end
else
print("You have to be a Jedi Knight+ to open/close this!")
end
end)
clickdetectorR.MouseClick:Connect(function()
if Player:GetRankInGroup(GroupID) >= minimumRank then
game.Workspace.Temple_0.EntryNeonDoor.Transparency = 0.7
game.Workspace.Temple_0.EntryNeonDoor.CanCollide = true
else
print("You have to be a Jedi Knight+ to close this!")
end
end)
clickdetectorC.MouseClick:Connect(function()
if Player:GetRankInGroup(GroupID) >= minimumRank then
game.Workspace.Temple_0.EntryNeonDoor.Transparency = 1
game.Workspace.Temple_0.EntryNeonDoor.CanCollide = false
else
print("You have to be a Jedi Knight+ to open this!")
end
end)
As I said, this worked as a LocalScript but I want it to work as a ServerScript → If I change this into ServerScript it says "attempt to index nil with “GetRankInGroup”. How can I fix this?