I’m trying to make a door that opens up and down when a button is clicked, but it isn’t really working. When you click the button, I want it to close the door, but if you press it again, I want it to to open the door. I followed this tutorial on YouTube, but the door doesnt seem to work.
local Stringvalue = script.Parent.Status
local TweenService = game:GetService("TweenService")
local DoorClose = {}
DoorClose.CFrame = door.CFrame * CFrame.new(0,-8,500,0)
local DoorOpen = {}
DoorOpen.Cframe = door.CFrame
local Doortime = TweenInfo.new(0.5)
local dooropen = TweenService:Create(door,Doortime,DoorOpen)
local doorclose = TweenService:Create(door,Doortime,DoorClose)
local dooropen = TweenService:Create(door,Doortime,DoorOpen)
local clickdetector = script.Parent:WaitForChild("ClickDetector")
clickdetector.MouseClick:Connect(function()
if Stringvalue.Value == "OPENED" then
doorclose:Play()
Stringvalue.value = "CLOSED"
script.Parent.Material = Enum.Material.Neon
script.Parent.BrickColor = BrickColor.Green()
elseif Stringvalue.Value == "CLOSED" then
dooropen:Play()
script.Parent.Material = Enum.Material.Glass
script.Parent.BrickColor = BrickColor.White()
end
end)
It also says there is something wrong with “DoorClose” but I can’t seem to find what…
Please Help!!!