#How to fix?
1 messages · Page 1 of 1 (latest)
Script for door:
local frame = script.Parent
local openSound = frame:WaitForChild("DoorOpen")
local closeSound = frame:WaitForChild("DoorClose")
local clickDetector = frame:WaitForChild("ClickDetector")
local model = frame.Parent
local frameClose = model:WaitForChild("DoorFrameClose")
local frameOpen = model:WaitForChild("DoorFrameOpen")
local opened = model:WaitForChild("Opened")
local tweenService = game:GetService("TweenService")
local debounce = true
clickDetector.MouseClick:Connect(function()
if debounce == true then
debounce = false
if opened.Value == true then
opened.Value = false
closeSound:Play()
tweenService:Create(frame,TweenInfo.new(3),{CFrame = frameClose.CFrame}):Play()
else
opened.Value = true
openSound:Play()
tweenService:Create(frame,TweenInfo.new(3),{CFrame = frameOpen.CFrame}):Play()
end
wait(0.35)
debounce = true
end
end)