I wanna make it where when the player gets added it runs a cutscene

local TweenService = game:GetService("TweenService")

local camera = game.Workspace.Camera

local cutsceneTime = 12

local tweenInfo = TweenInfo.new(
	cutsceneTime,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out,
	0,
	false,
	0
)

function tween(part1, part2, cutsceneTime)
local tweenInfo = TweenInfo.new(
	cutsceneTime,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out,
	0,
	false,
	0
)

	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = part1.CFrame
	
	local tween = TweenService:Create(camera, tweenInfo, {CFrame = part2.CFrame})
	tween:Play()
	
	wait(cutsceneTime)
	
	camera.CameraType = Enum.CameraType.Custom
end

game.Players.PlayerAdded:Connect(function()
	wait(5)
	tween(workspace.Camera1, workspace.Camera2, 10)
end)

me big noob pls help

1 Like

Instead of using

game.Players

use

local Players = game:GetService("Players")

at the top of the script, then

Players.PlayerAdded:Connect(function()
	wait(5)
	tween(workspace.Camera1, workspace.Camera2, 10)
end)

What’s your problem? I can’t tell anything from this script other than bugs.

I’m pretty sure that PlayerAdded functions do not get called correctly if they are used in a local script. Since the player loads in on the client side before the playeradded function can even be called.

I tried it in a ServerScript and it still doesn’t work.

The problem is that when I join I don’t get the cutscene but what I do want is well, cutscene when you join.

Well that’s because you have to edit the player camera through a local script. You will have to use some other way to wait till the player is in the game.

So then will i have to fire a remote event?

Yeah, that could be a way to do it.

2 Likes

You set cutsceneTime to 12, then set it to 10 later.

You used the same variable twice so that may be the problem.

1 Like