Im making a opening and closing door for my game and it did not work so I checked my output and it said that here is the script.
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(.35),{CFrame = frameClose.CFrame}):Play else opened.Value = true openSound:Play() tweenService:Create(frame,TweenInfo.new(.35),{CFrame = frameOpen.CFrame}):Play end wait(0.35) debounce = true end
end)
Sorry if your having a hard time reading it because when i pasted and asked it, it did that.
TweenInfo
requires multiple parameters to know what you want your part to do. The following code is from this website where you can learn more about TweenInfo.
local tweenInfo = TweenInfo.new( 2, -- Time Enum.EasingStyle.Linear, -- EasingStyle Enum.EasingDirection.Out, -- EasingDirection -1, -- RepeatCount (when less than zero the tween will loop indefinitely) true, -- Reverses (tween will reverse once reaching it's goal) 0 -- DelayTime ) local tween = TweenService:Create(part, tweenInfo, {Position = Vector3.new(0, 30, 0)})