Help with Cutscene Script

Hello! I made a cutscene script, that was supposed to be working fine. Absolutely no errors, yet I get no results.

Here is some footage of the script ‘not working’:

Some things in my script/stuff that may be the reason to this:

  • Folder-kept cameras
  • Using server script and not local script
  • Messed up on a small bit of code

Can someone check my script to see what I did wrong?

local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0 ,false, 0)
local triggerEvent = game.ReplicatedStorage:WaitForChild("Cutscene")
local cameraStrg = game.Workspace.CameraStorage
local bar1 = script.Parent.Bar1
local bar2 = script.Parent.Bar2
bar1.Position = UDim2.new(0,0, 0,0)
bar2.Position = UDim2.new(0,0, 0.5,0)

local gui = script.Parent
local dialog = gui.Text.Dialogue

local function Tween(Object, Value)
	local tween = TweenService:Create(Object, tweenInfo, {TextTransparency = Value})
	tween:Play()
end

local function Tween2(Object, Value)
	local tween = TweenService:Create(Object, tweenInfo, {TextStrokeTransparency = Value})
	tween:Play()
end

local camera = workspace.CurrentCamera
local config = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0)

local camTween = TweenService:Create(camera, config, {CFrame = cameraStrg.Cam2.CFrame} )

local function typeMessage(txt, typeTime)
	for i=1, #txt do
		dialog.Text = string.sub(txt, 1, i)
		wait(typeTime / #txt)
	end
end

triggerEvent.OnServerEvent:Connect(function()
	camera.CameraSubject = cameraStrg.Cam1
	camera.CFrame = cameraStrg.Cam1.CFrame
	camera.FieldOfView = 80
	camTween:Play()
	typeMessage("Text here", 2)
	camTween.Completed:Wait()
	-- wait()
	-- end of cutscene
	camera.CameraType = Enum.CameraType.Custom
	local player = game.Players.LocalPlayer
	local character = player.Character or player.CharacterAdded:Wait()
	local humanoid = character:WaitForChild("Humanoid")
	camera.CameraSubject = humanoid
	gui.Enabled = false
end)

Thank you in advance, and I will be waiting for a response!

Use a LocalScript instead. Cameras do belong to clients.

But the main purpose of the script was to make it so that it affects everyone when a player/s touch the Trigger. I am honestly stumped on what to do :man_standing:

Is the script you provided a local or server script?

The script here is a server script

Change it to a local script, parent the script to StarterPlayerScripts, and the following will be your new script:

local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0 ,false, 0)
local triggerEvent = game.ReplicatedStorage:WaitForChild("Cutscene")
local cameraStrg = game.Workspace.CameraStorage
local bar1 = script.Parent.Bar1
local bar2 = script.Parent.Bar2
bar1.Position = UDim2.new(0,0, 0,0)
bar2.Position = UDim2.new(0,0, 0.5,0)

local gui = script.Parent
local dialog = gui.Text.Dialogue

local function Tween(Object, Value)
	local tween = TweenService:Create(Object, tweenInfo, {TextTransparency = Value})
	tween:Play()
end

local function Tween2(Object, Value)
	local tween = TweenService:Create(Object, tweenInfo, {TextStrokeTransparency = Value})
	tween:Play()
end

local camera = workspace.CurrentCamera
local config = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0)

local camTween = TweenService:Create(camera, config, {CFrame = cameraStrg.Cam2.CFrame} )

local function typeMessage(txt, typeTime)
	for i=1, #txt do
		dialog.Text = string.sub(txt, 1, i)
		wait(typeTime / #txt)
	end
end

triggerEvent.OnClientEvent:Connect(function()
	camera.CameraSubject = cameraStrg.Cam1
	camera.CFrame = cameraStrg.Cam1.CFrame
	camera.FieldOfView = 80
	camTween:Play()
	typeMessage("Text here", 2)
	camTween.Completed:Wait()
	-- wait()
	-- end of cutscene
	camera.CameraType = Enum.CameraType.Custom
	local player = game.Players.LocalPlayer
	local character = player.Character or player.CharacterAdded:Wait()
	local humanoid = character:WaitForChild("Humanoid")
	camera.CameraSubject = humanoid
	gui.Enabled = false
end)

This should work, unless I’m missing something about workspace…

Can this script allow everyone to see the cutscene?

In the sense that if one player touches the trigger, then everyone will get the cutscene?

Yep.

I’ll go test it out later, 'cause I’m on my phone. I’ll reply to you again if it works or not :blush:

Then you must run the code in every client. You can make that using RemoteEvents. Or play the tween on server and view the camera in each client.

In the video, it shows that when the part is touched, it runs FireAllClients().

Ok its either my eyes but i dont see you playing the tween function Tween and Tween2 anywhere.

I might(Very Strong Probability xD) be wrong as i suck at concentrating.

Ah my bad, I didn’t see that.
30000

Ok i used CTRL+F to Find you Calling the Function and it seriously isnt there. You need to call it first :expressionless:

What? Also reply next time or ping us.

I think I know the solution, but idk how to properly code it. Basically, when the ServerEvent happens, it duplicates the script to everyone. Can someone help me with the duplication script?

I actually just found out the solution, I basically just made it so that when you activate something (touch, prompt, etc.) then it’ll make a script I made in ServerScriptStorage or smth like that, and activate the RemoteEvent via FireAllClients(). In the local script for the guicustscene, I just put OnClientEvent, and it works. Although, thanks for the help everyone!