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

How do I play sound for only the guy in the cutscene?

Asked by 10 years ago

Hey, I have a cutscene with music, but if someone joins, you hear the music. It's ugly. How do I make it only for the guy who's ment to? Cutscene script:

01repeat wait () until game.Workspace.CurrentCamera ~= nil
02game.Workspace.Sound:Play(148206769)
03 
04local c = game.Workspace.CurrentCamera
05local data = LoadLibrary("RbxUtility").DecodeJSON(script.CutsceneData.Value)
06local rs = game:GetService("RunService").RenderStepped
07 
08function tweenCam(c1,f1,time,fov,roll)
09    local c0,f0,fv0,r0,frames = c.CoordinateFrame,c.Focus,c.FieldOfView,c:GetRoll(),time/0.015
10    for i = 1,frames do
11        c.CameraType = "Scriptable"
12        c.CoordinateFrame = CFrame.new(c0.p:lerp(c1.p,i/frames),f0.p:lerp(f1.p,i/frames))
13        c.FieldOfView = (fv0+(fov-fv0)*(i*(1/frames)))
14        c:SetRoll(r0+(roll-r0)*(i*(1/frames)))
15        rs:wait()
View all 45 lines...

I'd also like to know when I have a skip button, how to let the music stop when the skip button is pushed?

1 answer

Log in to vote
1
Answered by
dyler3 1510 Moderation Voter
10 years ago

The Cutscene script:

01repeat wait () until game.Workspace.CurrentCamera ~= nil
02Sound=game.Workspace.Sound
03SoundC=Sound:clone()
04SoundC.Parent=game.Players.LocalPlayer.PlayerGui
05SoundC:Play()
06 
07local c = game.Workspace.CurrentCamera
08local data = LoadLibrary("RbxUtility").DecodeJSON(script.CutsceneData.Value)
09local rs = game:GetService("RunService").RenderStepped
10 
11function tweenCam(c1,f1,time,fov,roll)
12    local c0,f0,fv0,r0,frames = c.CoordinateFrame,c.Focus,c.FieldOfView,c:GetRoll(),time/0.015
13    for i = 1,frames do
14        c.CameraType = "Scriptable"
15        c.CoordinateFrame = CFrame.new(c0.p:lerp(c1.p,i/frames),f0.p:lerp(f1.p,i/frames))
View all 48 lines...

The "Main" script:

01repeat wait () until script.Parent.Cutscene.Value ~= nil
02script.Parent.Skip.Visible = true
03 
04function onClicked()
05    script.Parent.Cutscene.Value:Destroy()
06    game.Workspace.CurrentCamera.CameraType = "Custom"
07    game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
08    game.Workspace.CurrentCamera.FieldOfView = 70
09    script.Parent:Destroy()
10    game.Players.LocalPlayer.PlayerGui.Sound:remove()
11end
12 
13script.Parent.Skip.MouseButton1Down:connect(onClicked)

This should all work now...I tested it and it worked for me so...

0
Now the whole cutscene wont start up. Maybe I have to put the first 8 sentences after number 10? coolguy1v1 0 — 10y
0
Oh, sorry about that. I think you're right. Try that, if it doesnt work, let me know dyler3 1510 — 10y
0
It does not. I saw if I do the thing you did, that the second person who joins get the cutscene, but yet no sound. also, the skip button dissapears. coolguy1v1 0 — 10y
0
Maybe I could send you the script via email, or something, so you could make it work? (or the whole game, so you can let it fit) coolguy1v1 0 — 10y
View all comments (4 more)
0
I will send you a roblox PM coolguy1v1 0 — 10y
0
I sent you a pm. coolguy1v1 0 — 10y
0
Ok, we'll talk on their dyler3 1510 — 10y
0
When will we talk??? coolguy1v1 0 — 10y
Ad

Answer this question