Ye I’m working on it, I think I messed up the priority.
Yes I think too. I suggest to leave one line for each part of things in the script to don’t make it a messy.
Hmm outside button are diffcult to script to sript, here is what I wrote :
buttonOutSecond.Triggered:Connect(function()
if debounce == false then
debounce = true
tween2:Play()
tween4:Play()
tween6:Play()
tween8:Play()
soundp:Play()
print("Waiting for the elevator")
wait(waitTime)
for _, players in pairs(game.Players:GetPlayers()) do
if script.Parent.Elevator.DetectionArea.Touched then
players.Character:WaitForChild("HumanoidRootPart").CFrame =TeleportPositionDown.CFrame
elseif script.Parent.Elevator2.DetectionArea.Touched then
players.Character:WaitForChild("HumanoidRootPart").CFrame =TeleportPositionUp.CFrame
end
end
if down == true then
tween5:Play()
tween7:Play()
down = false
elseif down == false then
tween:Play()
tween3:Play()
down = true
end
print("Opening doors")
debounce = false
end
end)
And what’s the problem now?
As I understood you want that when the outside button of the elevator2 gets triggered it have to teleport all the players in its detection area to the other elevator right?
No.
Lemme explain.
When a payer have access to the inside utton, it means that the elevator is up (or down, depending on which button is pressed). For the outside button, we don’t know if the elevator is up or down, cuz the player can call it, or make it go down. So i need to add a statement, the problem is that it teleports the player EVEN if he isn’t inside the elevator
for _, players in pairs(game.Players:GetPlayers()) do
if down == false then
script.Parent.Elevator2.DetectionArea.Touched:Connect(function()
players.Character:WaitForChild("HumanoidRootPart").CFrame = TeleportPositionDown.CFrame
end)
down = true
else
script.Parent.Elevator.DetectionArea.Touched:Connect(function()
players.Character:WaitForChild("HumanoidRootPart").CFrame = TeleportPositionUp.CFrame
end)
down = false
end
end
Huh…
For some reason it tp the player infinitly
Between Elevator 1 and 2
This is taking too much time, I will send the complete elevator in the evening.
@Black_Albi here’s the file with the WORKING elevator i’ve changed the .Touched part of the script with the Region3 function anyways: Elevator.rbxl (97.9 KB) .