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

Hey so how do I add music to my cutscene?

I want to have creepy music in this cutscene Script:

local TweenService = game:GetService("TweenService")

local camera = game.Workspace.Camera

local cutsceneTime = 6

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

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

wait(2)

tween(game.Workspace.Test1,game.Workspace.Test2,game.Workspace.Test3,game.Workspace.Test4,game.Workspace.Test5,game.Workspace.Test6)

1 answer

local TweenService = game:GetService("TweenService")

local camera = game.Workspace.Camera

local cutsceneTime = 6

local CreepyMusic = Instance.new("Sound")
CreepyMusic.Parent = game.Workspace
CreepyMusic.SoundId = "rbxassetid://178619276"
CreepyMusic.Looped = true
CreepyMusic.Playing = false

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

function tween(part1,part2,part3,part4,part5,part6)
    camera.CameraType = Enum.CameraType.Scriptable
    camera.CFrame = part1.CFrame
    CreepyMusic:Play()
    local tween = TweenService:Create(camera, tweenInfo, {CFrame = part2.CFrame})
    tween:Play()

    wait(cutsceneTime)

        local tween = TweenService:Create(camera, tweenInfo, {CFrame = part3.CFrame})
    tween:Play()

    wait(cutsceneTime)

        local tween = TweenService:Create(camera, tweenInfo, {CFrame = part4.CFrame})
    tween:Play()

    wait(cutsceneTime)

        local tween = TweenService:Create(camera, tweenInfo, {CFrame = part5.CFrame})
    tween:Play()

    wait(cutsceneTime)

        local tween = TweenService:Create(camera, tweenInfo, {CFrame = part6.CFrame})
    tween:Play()

    wait(cutsceneTime)

    camera.CameraType = Enum.CameraType.Custom
    CreepyMusic:Stop()
end

wait(2)

tween(game.Workspace.Test1,game.Workspace.Test2,game.Workspace.Test3,game.Workspace.Test4,game.Workspace.Test5,game.Workspace.Test6)

2 comments

1

Can I add something? Never use the 2nd Parameter of Instance.new(), It's deprecated.

0

Do you mean instance.new("Sound", workspace)?

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