Here is my script:

_G.Cutscene = function()
	local camera = game.Workspace.CurrentCamera
	local plr = game.Players.LocalPlayer

	camera.CameraType = Enum.CameraType.Scriptable
	camera:Interpolate(game.Workspace.Part1.CFrame, game.Workspace.LookAt.CFrame, 0.01)
	wait(0.1)
	camera:Interpolate(game.Workspace.Part2.CFrame, game.Workspace.LookAt.CFrame, 3)
	wait(3)
	camera:Interpolate(game.Workspace.Part3.CFrame, game.Workspace.LookAt.CFrame, 3)
	wait(3)
	camera.CFrame = game.Workspace.Part4.CFrame
	camera:Interpolate(game.Workspace.Part5.CFrame, game.Workspace.LookAt.CFrame, 3)
	wait(3)
	camera.CFrame = game.Workspace.Part7.CFrame
	camera:Interpolate(game.Workspace.Part7.CFrame, game.Workspace.LookAt.CFrame, 3)
	wait(3)
	
	camera.CameraType = Enum.CameraType.Custom
end

It is an Interpolate script. It is a Local Script in the StarterGUI. As you can see it is a global function. The reason its global is because I think it needs to be a Local Script. Here is the part of the other script that calls this function:

repeat wait() until _G.Cutscene ~= nil
	_G.Cutscene()

When I first wrote this script, it wasn't global. It was just it's own script. And it was a MouseButton1Clicked function. And it always worked perfectly fine. Now I want it to be connected with my other script. But for some reason, it's not working! It's not giving me any error messages which is really weird since it's not doing anything. Can somebody please help me? Thank you.

2 comments

0

im having a hard time understanding what this does and i cant read it well

0

when I write my function like this: "game.StarterGui.ScreenGui.TextButton.MouseButton1Click:connect(function()", it works. When I do it like this: "function Cutscene()", it doesn't.