I keep getting errors relating ends
local frame = script.Parent
local openSound = script.Parent.DoorOpen
local closeSound = script.Parent.DoorClose
local proximityprompt = frame.PromptAttachment.ProximityPrompt
local model = script.Parent.Parent
local frameClose = model:WaitForChild("DoorClosed")
local frameOpen = model:WaitForChild("DoorOpened")
local opened = model:WaitForChild("Opened")
local tweenService = game:GetService("TweenService")
local alarm = script.Parent.Parent.AlarmPart.Alarm
local alarm2 = script.Parent.Parent.AlarmPart.Alarm2
local BadGuys = game:GetService("Teams")["Team2"]
local GoodGuys = game:GetService("Teams")["Team1"]
local deniedsound = script.Parent.Denied
local debounce = true
proximityprompt.Triggered:Connect(function()
if debounce == true then
debounce = false
game:GetService("Players").PlayerAdded:Connect(function(Player)
if Player.Team == BadGuys then
openSound:Play()
alarm:Play()
alarm2:Play()
tweenService:Create(frame,TweenInfo.new(.35),{CFrame = frameOpen.CFrame}):Play()
proximityprompt.Enabled = false
wait(45)
closeSound:Play()
alarm:Stop()
alarm2:Stop()
tweenService:Create(frame,TweenInfo.new(.35),{CFrame = frameClose.CFrame}):Play()
wait(120)
proximityprompt.Enabled = true
elseif Player.Team == GoodGuys then
deniedsound:Play()
print("You're on the wrong team!")
debounce = true

1 comment
best way to do it is to format the document (script menu), and then just add and remove the ends you need to!