Im not exactly sure what data you’re asking for.
This is where I define the parts and the vectors
local doorModel1 = script.Parent.Part1
local doorModel2 = script.Parent.Part2
local part1a = doorModel1:FindFirstChild("A")
local part1b = doorModel1:FindFirstChild("B")
local part1c = doorModel1:FindFirstChild("C")
local part2a = doorModel2:FindFirstChild("A")
local part2b = doorModel2:FindFirstChild("B")
local part2c = doorModel2:FindFirstChild("C")
local initialPosition1a = part1a.Position
local initialPosition1b = part1b.Position
local initialPosition1c = part1c.Position
local initialPosition2a = part2a.Position
local initialPosition2b = part2b.Position
local initialPosition2c = part2c.Position
local openOffset1 = Vector3.new(4, 0, 0) -- Change these offsets as needed
local openOffset2 = Vector3.new(-4, 0, 0) -- Change these offsets as needed
...
local doorOpen = script:FindFirstChild("Value")
...
local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut)
This the relevant part of the door closing and opening function
local function toggleDoor()
-- Check if the button is on cooldown
if isOnCooldown then
return
end
...
if doorOpen.Value == true then
doorOpen.Value = false
local part1aTween1 = game:GetService("TweenService"):Create(part1a, tweenInfo, {Position = initialPosition1a})
local part1bTween1 = game:GetService("TweenService"):Create(part1b, tweenInfo, {Position = initialPosition1b})
local part1cTween1 = game:GetService("TweenService"):Create(part1c, tweenInfo, {Position = initialPosition1c})
local part2aTween1 = game:GetService("TweenService"):Create(part2a, tweenInfo, {Position = initialPosition2a})
local part2bTween1 = game:GetService("TweenService"):Create(part2b, tweenInfo, {Position = initialPosition2b})
local part2cTween1 = game:GetService("TweenService"):Create(part2c, tweenInfo, {Position = initialPosition2c})
part1aTween1:Play()
part1bTween1:Play()
part1cTween1:Play()
part2aTween1:Play()
part2bTween1:Play()
part2cTween1:Play()
else
doorOpen.Value = true
local part1aTween2 = game:GetService("TweenService"):Create(part1a, tweenInfo, {Position = initialPosition1a + openOffset1})
local part1bTween2 = game:GetService("TweenService"):Create(part1b, tweenInfo, {Position = initialPosition1b + openOffset1})
local part1cTween2 = game:GetService("TweenService"):Create(part1c, tweenInfo, {Position = initialPosition1c + openOffset1})
local part2aTween2 = game:GetService("TweenService"):Create(part2a, tweenInfo, {Position = initialPosition2a + openOffset2})
local part2bTween2 = game:GetService("TweenService"):Create(part2b, tweenInfo, {Position = initialPosition2b + openOffset2})
local part2cTween2 = game:GetService("TweenService"):Create(part2c, tweenInfo, {Position = initialPosition2c + openOffset2})
part1aTween2:Play()
part1bTween2:Play()
part1cTween2:Play()
part2aTween2:Play()
part2bTween2:Play()
part2cTween2:Play()
...
end
end)
end
Then this function waits for the event to be fired
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MusterAlarmEvent = ReplicatedStorage:WaitForChild("MusterAlarmEvent")
local function onMusterAlarm()
toggleDoor()
end
MusterAlarmEvent.OnClientEvent:Connect(onMusterAlarm)
Please let me know if you need other data. As I said earlier, the event fires correctly and connects.