Heya! I’m lcey. Tiny developer. Currently working on a project called Area 53, I need help on a door script of mine that involves cframe things. Lookvector to be specific. If you could please take a look, and maybe solve my issue. That’d be chill.
So there is two mesh doors. Door1 (left), and Door2 (right). They’re supposed to go separate ways for 5s, then stop. Yet they go out for 5s, then stop. Screenshot;
I’ve tried rightVector, yet it only did the same thing! Tried asking friends, they tried a way idk, then said they “were unable to do it, too hard”. So I figured I’d come here.
Source code:
local LeftDoor = script.Parent.Door2
local RightDoor = script.Parent.Door1
local prox1 = script.Parent.Parent.Keycard1.Union
local prox2 = script.Parent.Parent.Keycard2.Union
local Open = false
local plr = game:GetService("Players").LocalPlayer
--local teamserv = game:GetService("Teams")
local OpenSound = RightDoor.DoorOpen
local CloseSound = RightDoor.DoorClose
local beep = RightDoor.Beep
local Debounce = false
function proxused(plr)
if not Debounce then
Debounce = true
if Open then
Open = false
prox1.ProximityPrompt.ActionText = "Open"
prox2.ProximityPrompt.ActionText = "Open"
CloseSound:Play()
beep:play()
spawn(function()
for i = 1, 60 do
LeftDoor.CFrame = LeftDoor.CFrame + (LeftDoor.CFrame.LookVector * 0.1)
wait(0.05)
end
end)
spawn(function()
for i = 1, 60 do
RightDoor.CFrame = RightDoor.CFrame + (RightDoor.CFrame.LookVector * 0.1)
wait(0.05)
end
end)
else
Open = true
OpenSound:Play()
beep:play()
prox1.ProximityPrompt.ActionText = "Close"
prox2.ProximityPrompt.ActionText = "Close"
spawn(function()
for i = 1, 60 do
LeftDoor.CFrame = LeftDoor.CFrame - (LeftDoor.CFrame.lookVector * 0.1)
wait(0.05)
end
end)
spawn(function()
for i = 1, 60 do
RightDoor.CFrame = RightDoor.CFrame - (RightDoor.CFrame.lookVector * 0.1)
wait(0.05)
end
end)
end
wait(3)
Debounce = false
end
end
prox1.ProximityPrompt.Triggered:Connect(proxused)
prox2.ProximityPrompt.Triggered:Connect(proxused)
If you could please help me, that’d be great. I’m kinda stumped. My main type category is modeling, not scripting.
-lcey