Hello fellow scripters!
I’m trying to animate and script a door, and I can’t find any relevant information. The only good source I find is this video: https://www.youtube.com/watch?v=zTrwGZQCgTs
Here is the code:
local door = script.Parent.Door
local closePlaceholder = script.Parent.DoorClosed
local openPlaceholder = script.Parent.DoorOpened
local clickDetector = door.ClickDetector
local closeSound = door.Close
local openSound = door.Open
local debounce = true
local isOpened = false
local info = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, false, 0)
local closeProperties = (CFrame = closePlaceholder.CFrame)
local openProperties = (CFrame = openPlaceholder.CFrame)
local closeTween = game.TweenService:Create(door, info, closeProperties)
local openTween = game.TweenService:Create(door, info, openProperties)
clickDetector.MouseClick:Connect(function()
if debounce then
debounce = false
if not isOpened then
openSound:Play()
openTween:Play()
else
closeSound:Play()
closeTween:Play()
end
isOpened = not isOpened
wait(1)
debounce = true
end
end)
I have everything labeled correctly from the script to workspace, but I am getting this error code: Expected ‘)’ (to close ‘(’ at column 25), got ‘=’; did you mean to use ‘{’ when defining a table? In the video it worked really well, and it’s from April. Other people in the comments are having the same problem, not sure if it’s the code or what’s happening.
Anyone have some tips or a solution to this?