-
What do you want to achieve? A door system, though I am having an error.
-
What is the issue? Only 1 door is able to open. When said door closes, another one is able too
-
I looked on dev forum + youtube
-- @classMod DoorService
-- @author lumbergrim
-- Handles All Doors
local Players = game:GetService("Players")
local CS = game:GetService("CollectionService")
local TweenService = game:GetService("TweenService")
local RReplicated = game:GetService("ReplicatedStorage")
local Debounce = false
-- Door Var
local Sounds = RReplicated.doors.Sounds
local Doors = RReplicated.doors
local Success = Doors.success
local Failed = Doors.failed
local Lockdown = Doors.failed
local DoorsService = {}
for _,BlastDoor in pairs(workspace.Doors.BlastDoor:GetChildren()) do
if BlastDoor:IsA("Model") then
CS:AddTag(BlastDoor, "BlastDoor")
end
end
local function BlastDoorFunction()
if CS:GetTagged("BlastDoor") then
for _,Tags in pairs(CS:GetTagged("BlastDoor")) do
Tags:FindFirstChild("Union").ProximityPrompt.Triggered:Connect(function(plr)
local TweenInformation = TweenInfo.new(
4,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
true,
0.5)
if not Debounce then
Debounce = true
local tween = TweenService:Create(Tags.PrimaryPart, TweenInformation, {Position = Tags.Closed.Position})
tween:Play()
Sounds.BlastDoorOpen:Play()
Success:FireClient(plr)
wait(4)
tween:Pause()
wait(3)
tween:Play()
wait(4.4)
Debounce = false
end
end)
end
end
end
local BlastDoor = CS:GetInstanceAddedSignal("BlastDoor")
BlastDoor:Connect(BlastDoorFunction())
return DoorsService