Cutscene has a loop after saying "We're back!"

Hello. I am the developer of BLO (Bacon League Online) and i’m struggling with getting this to work. The camera also resets. This is the code.

task.wait()
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character

local CameraFolder = workspace:WaitForChild("CameraScenes")
local CameraTarget = CameraFolder["Camera"]
local Animate = require(script.Animation)

local Camera = workspace.CurrentCamera
repeat task.wait()
	workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
until workspace.CurrentCamera.CameraType == Enum.CameraType.Scriptable
game["Run Service"].Heartbeat:Connect(function()
	workspace.CurrentCamera.CFrame = CameraTarget.CFrame
end)
Camera.CameraSubject = CameraTarget

local Dialog = Player.PlayerGui:WaitForChild("dialog")

local TweenService = game.TweenService
--TweenService:Create(
--	workspace:WaitForChild("Characters").Red.Torso.Neck,
--	TweenInfo.new(0.5),
--	{["C0"] = CFrame.new(workspace:WaitForChild("Characters").Red.Torso.Neck.C0.Position.X,workspace:WaitForChild("Characters").Red.Torso.Neck.C0.Position.Y,workspace:WaitForChild("Characters").Red.Torso.Neck.C0.Position.Z) * CFrame.fromEulerAnglesXYZ(math.rad(-70), math.rad(-180), math.rad(workspace:WaitForChild("Characters").Red.Torso.Neck.C0.Rotation.Z))}):Play()
local time_ = 3

Animate.typeWrite(Dialog.Holder.Dialog, "Wheres Blue and Green?", 0.05, workspace:WaitForChild("Characters").Red)
task.wait(time_)
Animate.typeWrite(Dialog.Holder.Dialog, "They should've been here by now.", 0.05, workspace:WaitForChild("Characters").Red)
task.wait(time_)
Animate.typeWrite(Dialog.Holder.Dialog, "", 0.05, workspace.Characters.Red)
bell = script.bell:Clone()
bell.Parent = workspace
bell:Play()
bell.Ended:Connect(function()
	bell.knock:Play()
	bell.knock.Ended:Connect(function()
		bell:Destroy()
		task.wait(1)
		game.ReplicatedStorage.moving:FireServer()
	end)
end)
task.wait(1.2)
workspace:WaitForChild("Characters").Red.Humanoid.MoveToFinished:Connect(function(reached)
	
	print("Finished!")
		workspace.CameraScenes.Camera.Position = Vector3.new(-6.653, 6.931, 32.8)
	workspace.CameraScenes.Camera.Rotation = Vector3.new(0, 180, 0)
	task.wait(2)
	Animate.typeWrite(Dialog.Holder.Dialog, "What's this?", 0.05, --Always loops here. workspace.Characters.Red)
	task.wait(3)
	Animate.typeWrite(Dialog.Holder.Dialog, "A note?", 0.05, workspace.Characters.Red)
	task.wait(2)
	workspace.Characters.Red.Humanoid.Animator:LoadAnimation(workspace.Characters.Red
		.Humanoid.Animator.PickUp
	):Play()
	workspace.Note.Parent = game.ReplicatedStorage
	task.wait(1)
	Animate.typeWrite(Dialog.Holder.Dialog, "I'll save it when everybody gets here.", 0.05, workspace.Characters.Red)
	task.wait(1)
	Animate.typeWrite(Dialog.Holder.Dialog, "", 0.05, workspace.Characters.Red)
	game.ReplicatedStorage.moving2:FireServer()
	task.wait(2)
	workspace.CameraScenes.Camera.Position = Vector3.new(-6.307, 6.926, 109.758)
	workspace.CameraScenes.Camera.Rotation = Vector3.new(0, 0, 0)
	game.ReplicatedStorage.Blue:Clone().Parent = workspace.Characters
	game.ReplicatedStorage.Green:Clone().Parent = workspace.Characters
	Animate.typeWrite(Dialog.Holder.Dialog, "We're back!", 0.05, workspace.Characters:WaitForChild("Blue"))
	game.ReplicatedStorage.moving3:FireServer()
	workspace.CameraScenes.Camera.Position = Vector3.new(-6.307, 6.926, 109.758)
	workspace.CameraScenes.Camera.Rotation = Vector3.new(0, 0, 0)
	task.wait(3)

	Animate.typeWrite(Dialog.Holder.Dialog, "Huh?..", 0.05, workspace.Characters:WaitForChild("Blue"))
	
	workspace.CameraScenes.Camera.Position = Vector3.new(-6.307, 6.926, 109.758)
	workspace.CameraScenes.Camera.Rotation = Vector3.new(0, 0, 0)
	task.wait(3)

	Animate.typeWrite(Dialog.Holder.Dialog, "Hey! What's going on?", 0.05, workspace.Characters:WaitForChild("Yellow"))
	workspace.CameraScenes.Camera.Position = Vector3.new(-6.307, 6.926, 109.758)
	workspace.CameraScenes.Camera.Rotation = Vector3.new(0, 0, 0)
	task.wait(3)

	Animate.typeWrite(Dialog.Holder.Dialog, "What's that?", 0.05, --The problem workspace.Characters:WaitForChild("Yellow"))
	workspace.CameraScenes.Camera.Position = Vector3.new(-6.307, 6.926, 109.758)
	workspace.CameraScenes.Camera.Rotation = Vector3.new(0, 0, 0)
	task.wait(3)
	workspace.CameraScenes.Camera.Position = Vector3.new(-6.307, 6.926, 109.758)
	workspace.CameraScenes.Camera.Rotation = Vector3.new(0, 0, 0)
	Animate.typeWrite(Dialog.Holder.Dialog, "Hey-- Is that a gas bomb?", 0.05, workspace.Characters:WaitForChild("Pink").. " and Orange")

task.wait(5)
	game.Players.LocalPlayer:Kick("ello")
end)

Please help, our testers are getting really confused and they’re requesting if we dont get the cutscene to work, might as well DELETE it.
Anyways, i’ve tried everything, and it seems not to work.

1 Like

10 days later, theres no response.

I think Roblox is shadowbanning me. I have gotten no help for the past 14 days, and this is still an issue.

Nope, nobody really wants to help you with your solution, but I’ll try to!

Give me a moment to look at the code and understand whats going on here, I’m not the most advanced lua scripter and I’ve never worked with cutscenes but I’ll try to help!

can you send us a video about the issue in-game?

have you tried to use cframe instead of using vector3?

i would say that is this function that is causing the issue:

workspace:WaitForChild(“Characters”).Red.Humanoid.MoveToFinished:Connect(function(reached)

my guess is that it is probably playing the cutscene multiple times, that why it loops.

try this:

workspace:WaitForChild(“Characters”).Red.Humanoid.MoveToFinished:Once(function(reached)

Thanks for the solution! I’ll finish up the details so we can finish the. Cutscene. But thanks again! the stuff where it started at “I’ll” was something to do something about 30

1 Like

another fix for this if you want to use :Connect instead of :Once is to make a debounce.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.