Hi I'm trying to create a simple camera "tween" and after that tween the camera will stay fixed until the dialog ends Video
The issue that I have is that when I first call my coroutine to resume it will run as expected but after calling it again the status will return dead.
here is the code
local CanLoopCam = false
local TweenCam = coroutine.create(function()
CanLoopCam = false
if not CanLoopCam then
for i = 0,0.5,.01 do
Camara.CFrame = Camara.CFrame:Lerp(PP.Parent.Parent.o.CFrame, i)
task.wait()
end
CanLoopCam = true
while CanLoopCam do
task.wait()
Camara.CFrame = PP.Parent.Parent.o.CFrame
end
end
end)
function CANTtalk()
CanLoopCam = false
canTalk = true
Camara.CameraType = Enum.CameraType.Custom
MainFrame.Dialogo.Text = " "
humanoid.WalkSpeed = 20
end
function CANtalk()
print(coroutine.status(TweenCam))
canTalk = false
Camara.CameraType = Enum.CameraType.Scriptable
humanoid.WalkSpeed = 0
MainFrame.Titulo.Text = npc.Name
coroutine.resume(TweenCam)
end
I tried yielding but it stops everything. Video
function CANTtalk()
CanLoopCam = false
canTalk = true
Camara.CameraType = Enum.CameraType.Custom
MainFrame.Dialogo.Text = " "
humanoid.WalkSpeed = 20
coroutine.yield(TweenCam)
end
Help is appreciated, I tried a lot of stuff but I'm still learning how to script

1 comment
Have you tried Rerunning it? it seems it only runs once and afterwards it seems it will not rerun because it has already finished.