So, I have a function that tweens a door model out, waits some time, then in. Here it is:
local Move = function(Model, ToCFrame, TimeOfDelay)
if Mode == "Fast" then
wait(TimeOfDelay)
Model:SetPrimaryPartCFrame(ToCFrame)
elseif Mode == "Tween" then
local CFrameValue = Instance.new("CFrameValue")
CFrameValue.Value = Model:GetPrimaryPartCFrame()
CFrameValue:GetPropertyChangedSignal("Value"):Connect(function()
Model:SetPrimaryPartCFrame(CFrameValue.Value)
end)
local Info = TweenInfo.new(TimeOfDelay, Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,false,0)
local Tween = game:GetService("TweenService"):Create(CFrameValue, Info, {Value = ToCFrame})
Tween:Play()
Self = Tween.Completed:Connect(function()
CFrameValue:Destroy()
Self:Disconnect()
end)
wait(TimeOfDelay)
end
end
robloxapp-20200507-1121421.wmv (2.8 MB)
Anybody know what I did wrong?