I’m trying to make a tween function for opening and closing doors in a module script. But when I click on a door nothing happens and no error shows up in the output. Both scripts are below. All help is appreciated
Module Script:
local module = {}
module.tween = function(openDoor, closedDoor, Door)
local db = true
local isOpen = false
local ts= game:GetService("TweenService")
local info = TweenInfo.new(1,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,false,0)
local closedCFrame = {CFrame = closedDoor.CFrame}
local openedCFrame = {CFrame = openedDoor.CFrame}
local ct = ts:Create(door, info, closedCFrame)
local ot = ts:Create(d, info, openedCFrame)
Door:FindFirstChild("ClickDetector").MouseClick:Connect(function()
if not db then
db=false
if not isOpen then
ot:Play()
else
ct:Play()
end
isOpen=not isOpen
wait(1)
db=true
end
end)
end
return module
Script inside door model:
a=require(game.ReplicatedStorage.DoorToggle)
a.tween(script.Parent.OpenedDoor, script.Parent.ClosedDoor, script.Parent.Door)