Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Hey so how do I add music to my cutscene?

Asked by 4 years ago

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

Log in to vote
0
Answered by
rabbi99 714 Moderation Voter
4 years ago
Edited 4 years ago
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)
1
Can I add something? Never use the 2nd Parameter of Instance.new(), It's deprecated. Dovydas1118 1495 — 4y
0
Do you mean instance.new("Sound", workspace)? Cynical_Innovation 595 — 4y
Ad

Answer this question