I was trying to make a prison door involving the use of a ClickDetector which toggles the prison door. I used a LocalScript which fired a RemoteEvent when the ClickDetector was clicked, then my script detects when the event is fired and should of made the door change colors.
below is my LocalScript:
local RPS = game:GetService("ReplicatedStorage") -- fires the event for JailCell1
game.Workspace.JailCell1.cardVerify.ClickDetector.MouseClick:Connect(function(char)
local character = char.Parent
local doorName = 1
RPS.Modules.Events.triggerDoor:FireServer(character, doorName)
end)
game.Workspace.JailCell2.cardVerify.ClickDetector.MouseClick:Connect(function(char)
local character = char.Parent -- fires the event for JailCell2
local doorName = 2
RPS.Modules.Events.triggerDoor:FireServer(character, doorName)
end)
below is my ServerScript:
--jail cells--
local RPS = game:GetService("ReplicatedStorage")
RPS.Modules.Events.triggerDoor.OnServerEvent:Connect(function(player, character, doorName)
local player = game.Players:GetPlayerFromCharacter(player)
if doorName == 1 then
local jailCell1 = workspace.JailCell1
if jailCell1.Union.Transparency == 0 then
jailCell1.Union.Transparency = 1
jailCell1.Part.CanCollide = false
jailCell1.cardVerify.BrickColor = BrickColor.new("Dark stone grey")
elseif jailCell1.Union.Transparency == 1 then
jailCell1.Union.Transparency = 0
jailCell1.Part.CanCollide = true
jailCell1.cardVerify.BrickColor = BrickColor.new("Medium stone grey")
end
end
if doorName == 2 then
local jailCell2 = workspace.JailCell2
if jailCell2.Union.Transparency == 0 then
jailCell2.Union.Transparency = 1
jailCell2.Part.CanCollide = false
jailCell2.cardVerify.BrickColor = BrickColor.new("Dark stone grey")
elseif jailCell2.Union.Transparency == 1 then
jailCell2.Union.Transparency = 0
jailCell2.Part.CanCollide = true
jailCell2.cardVerify.BrickColor = BrickColor.new("Medium stone grey")
end
end
end)
I have had trouble with all of my RemoteEvents simply doing nothing, the event is fired but nothing else happens. No errors are given. Thanks for reading!

2 comments
Thank you for answering! The reason why I used a RemoteEvent was because I heard that ClickDetector function arguments didn't have script.Parent:FindFirstChild("Humanoid") to be able to be used.. Thanks!
You probably heard because it's true. Clickdetectors arguments get the player who clicked, so a player object. If you need a character from a clickdetector, i've edited my answer.