Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Hey so I need my cutscene at a specific time?

So I want my cutscene to only happen when the player spawn in, when I reset the cutscene plays again but its a lot more broken, your camera goes through the floor and glides on it, can you please make it so it will only happen when the player spawns in. Script:

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)
	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

wait(0)

tween(game.Workspace.Test1,game.Workspace.Test2)

2 comments

0

You mean a one time spawn-in cutscene?

0

Yes.

1 answer

This will stop the cutscene from happening again:

local TweenService = game:GetService("TweenService")
local Cutscenepassed = false --// value to say it HASNT happened yet.

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)
if not Cutscenepassed then
    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
end

wait(0)

tween(game.Workspace.Test1,game.Workspace.Test2)
Cutscenepassed = true

3 comments

0

Didnt work, its just made the camera tilt in a way wen you reset

0

Hmmm, well it only stops it from happening again so that means it's a problem with the script.

0

I edited the script a little, try now.

This discussion is preserved as it was. New answers, comments, and votes are closed.