when i added
script.IsOpened.Value = true
script.IsOpening.Value = true
script.Parent.CFrame = cf
script.OpenSound:Play()
end
the script suddenly broke. idk why :/
local cf = script.Parent.CFrame
function onClicked()
if script.IsOpened.Value == false and script.IsOpening.Value == false then
script.IsOpening.Value = true
for i = 1,16 do
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0, 0, -0.23) * CFrame.fromEulerAnglesXYZ(0, -0.1, 0)
wait(0.01)
end
script.IsOpening.Value = false
script.IsOpened.Value = true
elseif script.IsOpened.Value == true and script.IsOpening.Value == false then
script.IsOpening.Value = true
for i = 1,16 do
script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0, 0.1, 0) * CFrame.new(0, 0, 0.23)
wait(0.01)
end
script.IsOpening.Value = false
script.IsOpened.Value = false
script.Parent.CFrame = cf
script.CloseSound:Play()
end
script.IsOpened.Value = true
script.IsOpening.Value = true
script.Parent.CFrame = cf
script.OpenSound:Play()
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
this is a script in a brick. its a door.

1 comment
Please explain what you are trying to do, where the script is, whether it is a server or local script, and any output.