Hello all, I am trying to make a door system with bindable events but can’t seem to get it to work. Both of the following scripts are in ServerScriptService.
local Switch = workspace.Part
local clickDetector = Switch.ClickDetector
clickDetector.MouseClick:Connect(function()
game.ReplicatedStorage.BindableEvent:Fire()
print("Clicked")
end)
It detects the click but won’t fire the event.
local doorPart = workspace.DoorPart
local opened = doorPart.Opened
local function EventHappened()
if opened == false then
doorPart.Transparency = 0.4
doorPart.CanCollide = false
opened = true
print("Opened")
elseif opened == true then
doorPart.Transparency = 0
doorPart.CanCollide = true
opened = false
print("Closed")
end
end
game.ReplicatedStorage.BindableEvent.Event:Connect(EventHappened)
Thanks for help!