Hello there! I'm making a game and I need to make a door that is whitelisted so only people over the guest and cadet rank can open and close it. My game is filtering enabled and has to switch back and forth from the client and the server. I learned this month about remote events/remote functions (except I don't know much about remote functions) and tried to use them in this.
But it's not working. I tried to fix it but on line 10 on the open script it gives me this error
Argument 1 missing or nil
Can anyone help me?
Here are the scripts and parts.
Scripts:
Type of script = Script, Name of script = Open:
local CD = script.Parent.ClickDetector
local RS = game:GetService("ReplicatedStorage")
local RE = RS.RemoteEvents
local Debounce = false
if script.Parent.ClickDetector.MouseClick then
if Debounce == false then
Debounce = true
RE.DoorAClickCheck:FireClient()
wait(0.5)
end
end
RE.DoorAOpen.OnServerEvent:Connect(function()
if script.Parent.OpenValue == false then
script.Parent.Transparency = 0.5
script.Parent.CanCollide = false
end
if script.Parent.OpenValue == true then
script.Parent.Transparency = 0
script.Parent.CanCollide = true
end
end)
Type of script = LocalScript, Name of script = LocalOpen:
local CD = script.Parent.ClickDetector
local RS = game:GetService("ReplicatedStorage")
local RE = RS.RemoteEvents
local Player = game.Players.LocalPlayer
RE.DoorAClickCheck.OnClientEvent:Connect(function()
if Player.leaderstats.Rank == "Guest" or "Cadet" then
print("Rejected: Not Over Rank 2")
else
RE.DoorAOpen:FireServer()
end
end)
Remote events (These are in replicated storage and are both remote events. {I also have these duplicated but it is DoorB because I'm making another one of these doors.}) : DoorAClickCheck and DoorAOpen
Parts: DoorA
Inside of DoorA: ClickDetector, Open, OpenValue, And LocalOpen
Thanks for reading and or helping me,
Narwhal

2 comments
testing.
It worked, but I'm confused why the other bits of code in my scripts arent working. Could you help me with that? You don't have to if you don't want to.