Greetings!
I’m currently trying to make a border system, and wanted to tween a door, when I press it when closed it goes up, and if it is open and I press the button it closes.
Got really confused and still don’t know how to make sure the player can’t press to close the door when already closed
here is the current script:
local TweenService = game:GetService("TweenService")
local door = script.Parent.Parent.BDOOR
local info = TweenInfo.new(
1,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
local Goals = {
Position = Vector3.new(-28.02, 21.326, -8)
}
local doorTween = TweenService:Create(door, info, Goals)
local info2 = TweenInfo.new(
1,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
local Goals2 = {
Position = Vector3.new(-28.02, 7.375, -8)
}
local doorTween2 = TweenService:Create(door, info2, Goals2)
function borderdoorOpen()
doorTween:Play()
script.Open.Value = true
script.Parent.BrickColor = BrickColor.Red()
end
script.Parent.ClickDetector.MouseClick:connect(borderdoorOpen)
function closeDoor()
doorTween2:Play()
script.Parent.BrickColor = BrickColor.Green()
script.Open.Value = false
end
script.Parent.ClickDetector.MouseClick:connect(closeDoor)
Any Help is appreciated!