I created a door system that functions with proximity prompts, allowing players to open, close the door. When Locked then the player can open the door. I want the door to open in the opposite direction of the player who activates it. I have attempted this several times without success, so I am reaching out for assistance.

**Script (ServerScriptService)**

```
local TweenService = game:GetService("TweenService")
local CollectionService = game:GetService("CollectionService")
local infohand = TweenInfo.new(.3, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, false, 0)
local Colorinfo = TweenInfo.new(.75, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, false, 0)
local Cardinfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, false, 0)
local infoopen = TweenInfo.new(.85, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out, 0, false, 0)
local infoclose = TweenInfo.new(.75, Enum.EasingStyle.Quad, Enum.EasingDirection.In, 0, false, 0)
-- Iterate through all tagged doors
for _, model in pairs(CollectionService:GetTagged("Door")) do
if not model:IsA("Model") then continue end
local insval = Instance.new("BoolValue", model)
insval.Name = "Openor"
local insvalIngor = Instance.new("BoolValue", model)
insvalIngor.Name = "Ingor"
for _, i in pairs(model.DoorPart:GetChildren()) do
if i:IsA("BasePart") then
local weld = Instance.new("WeldConstraint")
weld.Parent = i
weld.Part0 = i
weld.Part1 = model.Hinge
i.Anchored = false
end
end
model.DoorPart.Prox.ProximityPrompt.Triggered:Connect(function()
if model.Ingor.Value == false then
model.Ingor.Value = true
model.HHinge.Anchored = true
model.DoorPart.Prox.ProximityPrompt.MaxActivationDistance = 0
model.DoorPart.Prox.ProximityPrompt.ActionText = "Close"
model.DoorPart.Prox2.ProximityPrompt.MaxActivationDistance = 0
model.Handle.Anchored = false
local locked = model:GetAttribute("Locked") or false
local twhd = TweenService:Create(model.HHinge, infohand, {CFrame = model.DoorPart.HHingeTo.CFrame})
twhd:Play()
if not locked then
if model.Openor.Value == false then
model.Openor.Value = true
model.Frame.Open:Play()
twhd.Completed:Wait()
model.HHinge.Weld.Enabled = true
model.HHinge.Anchored = false
local twdr = TweenService:Create(model.Hinge, infoopen, {CFrame = model.HingeTo.CFrame})
twdr:Play()
twdr.Completed:Wait()
model.HHinge.Anchored = true
model.HHinge.Weld.Enabled = false
twhd = TweenService:Create(model.HHinge, infohand, {CFrame = model.DoorPart.HHingeFrom.CFrame})
twhd:Play()
twhd.Completed:Wait()
else
model.Openor.Value = false
model.Frame.Close:Play()
twhd.Completed:Wait()
model.HHinge.Weld.Enabled = true
model.HHinge.Anchored = false
local twdr = TweenService:Create(model.Hinge, infoclose, {CFrame = model.HingeFrom.CFrame})
twdr:Play()
twdr.Completed:Wait()
model.Frame.Bang:Play()
model.HHinge.Anchored = true
model.HHinge.Weld.Enabled = false
twhd = TweenService:Create(model.HHinge, infohand, {CFrame = model.DoorPart.HHingeFrom.CFrame})
twhd:Play()
twhd.Completed:Wait()
model.DoorPart.Prox.ProximityPrompt.ActionText = "Open"
end
else
-- If locked, only animate the handle and play the locked sound
twhd.Completed:Wait()
twhd = TweenService:Create(model.HHinge, infohand, {CFrame = model.DoorPart.HHingeFrom.CFrame})
twhd:Play()
twhd.Completed:Wait()
-- Play the locked sound
local lockedSound = model.Frame:FindFirstChild("Locked") -- Ensure the sound is named correctly
if lockedSound then
lockedSound:Play()
end
model.DoorPart.Prox.ProximityPrompt.ActionText = "Open" -- Show Locked status
end
model.DoorPart.Prox.ProximityPrompt.MaxActivationDistance = 5
model.DoorPart.Prox2.ProximityPrompt.MaxActivationDistance = 5
model.Ingor.Value = false
end
end)
model.DoorPart.Prox2.ProximityPrompt.Triggered:Connect(function()
if model.Ingor.Value == false then
model.Ingor.Value = true
model.HHinge.Anchored = true
model.DoorPart.Prox.ProximityPrompt.MaxActivationDistance = 0
model.DoorPart.Prox.ProximityPrompt.ActionText = "Close"
model.DoorPart.Prox2.ProximityPrompt.MaxActivationDistance = 0
model.Handle.Anchored = false
local locked = model:GetAttribute("Locked") or false
local twhd = TweenService:Create(model.HHinge, infohand, {CFrame = model.DoorPart.HHingeTo.CFrame})
twhd:Play()
if not locked then
if model.Openor.Value == false then
model.Openor.Value = true
model.Frame.Open:Play()
twhd.Completed:Wait()
model.HHinge.Weld.Enabled = true
model.HHinge.Anchored = false
local twdr = TweenService:Create(model.Hinge, infoopen, {CFrame = model.HingeTo.CFrame})
twdr:Play()
twdr.Completed:Wait()
model.HHinge.Anchored = true
model.HHinge.Weld.Enabled = false
twhd = TweenService:Create(model.HHinge, infohand, {CFrame = model.DoorPart.HHingeFrom.CFrame})
twhd:Play()
twhd.Completed:Wait()
else
model.Openor.Value = false
model.Frame.Close:Play()
twhd.Completed:Wait()
model.HHinge.Weld.Enabled = true
model.HHinge.Anchored = false
local twdr = TweenService:Create(model.Hinge, infoclose, {CFrame = model.HingeFrom.CFrame})
twdr:Play()
twdr.Completed:Wait()
model.Frame.Bang:Play()
model.HHinge.Anchored = true
model.HHinge.Weld.Enabled = false
twhd = TweenService:Create(model.HHinge, infohand, {CFrame = model.DoorPart.HHingeFrom.CFrame})
twhd:Play()
twhd.Completed:Wait()
model.DoorPart.Prox.ProximityPrompt.ActionText = "Open"
end
else
-- If locked, only animate the handle and play the locked sound
twhd.Completed:Wait()
twhd = TweenService:Create(model.HHinge, infohand, {CFrame = model.DoorPart.HHingeFrom.CFrame})
twhd:Play()
twhd.Completed:Wait()
-- Play the locked sound
local lockedSound = model.Frame:FindFirstChild("Locked") -- Ensure the sound is named correctly
if lockedSound then
lockedSound:Play()
end
model.DoorPart.Prox.ProximityPrompt.ActionText = "Open" -- Show Locked status
end
model.DoorPart.Prox.ProximityPrompt.MaxActivationDistance = 5
model.DoorPart.Prox2.ProximityPrompt.MaxActivationDistance = 5
model.Ingor.Value = false
end
end)
end
```

Here is the game file for a better understanding of how the System works: DoorTests.rbxl

Thanks in advance!!!