I have so worked so hard on the cutscenes that I need a simple issue fixed which anybody can help me on this and quickly get me past this symbolic brick wall I have encountered.
- What do you want to achieve? Keep it simple and clear!
I would like the cutscenes script to only apply to the player touching the cutsceneblock part which triggers the cutscene.
I used this script: Piggy Cutscene Kit (Accurate) - Creator Store
- What is the issue? Include screenshots / videos if possible!
It works, it works great but everybody who touches the part which triggers the cutscene, causes every player to watch the same cutscene. This messes up my game cause now I cannot have the cutscenes without everybody being interrupted with a cutscene triggered by another player. It is already using localscript but that isn’t stopping everybody from being interrupted in the game to watch the same cutscene only one player should be watching.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I found one thread here on this forum but the script I am using does not use the Fire All Clients command so I am stuck.
https://devforum.roblox.com/t/local-script-running-for-all-players-not-just-one/1563681
I am looking for another script but then I would have to change everything which I worked so hard for.
How can I restrict or reword the cutscene script so that only one player who touches the cutscene block can view the cutscene and it not be shown to everybody?
Located in StarterGUI, folder called: “Cutscenes”:
local Camera = game.Workspace.CurrentCamera
local Character = game.Players.LocalPlayer.Character
local TService = game:GetService("TweenService")
local CamFolder = game.Workspace.CamFolder
CanPlayCutscene = true
local function InterpolateCamera(StartCam, EndCam, Duration)
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = StartCam.CFrame
local TInfo = TweenInfo.new(Duration, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0)
TService:Create(Camera, TInfo, {CFrame = EndCam.CFrame}):Play()
wait(Duration)
print("Done!")
end
local function FadeIn()
local Fade = script.Parent.Parent.AdditionalGui.FadeFrame
TService:Create(Fade, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0), {BackgroundTransparency = 0}):Play()
end
local function FadeOut()
local Fade = script.Parent.Parent.AdditionalGui.FadeFrame
TService:Create(Fade, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0), {BackgroundTransparency = 1}):Play()
end
local function typewrite(object,text)
for i = 1,#text,1 do
object.Text = string.sub(text,1,i)
wait(0.09)
end
end
--Finally, the cutscene:
local function PlayCutscene()
--GUI assets:
local DGui = script.Parent.Parent.DialogGui
local CharName = DGui.CharacterName.TextLabel
local DText = DGui.DialogFrame.Dialog
wait()
script.Parent.Parent.AdditionalGui.FadeFrame.BackgroundTransparency = 0
wait(1.5)
InterpolateCamera(CamFolder.Cam0, CamFolder.Cam0, 1)
wait(2)--Time for start cutscene
FadeOut()
wait(2)
DGui.Enabled = true--VERY IMPORTANT, DON'T FORGET TO PUT IT!
--Appear "You escaped":
TService:Create(script.Parent.Parent.AdditionalGui.YouEscapedLabel, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0), {TextTransparency = 0}):Play()
--Change character assets:
CharName.Text = "Fat Cat"--Character Name
CharName.TextColor3 = Color3.fromRGB(255, 255, 255)--Character name color.
DText.TextColor3 = Color3.fromRGB(255, 255, 255)--Dialog color.
local Play = script.Music1:Play()
local Play = true
typewrite(DText, "Angel Girl Brianna defeated me last time.")
wait(4)--Time before interpolate the camera again, change if you want.
CharName.Text = "Fat Cat"--Character Name
CharName.TextColor3 = Color3.fromRGB(255, 255, 255)--Character name color.
DText.TextColor3 = Color3.fromRGB(255, 255, 255)--Dialog color.
local Play = script.Music2:Play()
local Play = true
typewrite(DText, "I will get my revenge on you. Hahahaha")
wait(4)--Time before interpolate the camera again, change if you want.
InterpolateCamera(CamFolder.Cam0, CamFolder.Cam1, 2)
CharName.Text = "Fat Cat"--Character Name
CharName.TextColor3 = Color3.fromRGB(255, 255, 255)--Character name color.
DText.TextColor3 = Color3.fromRGB(255, 255, 255)--Dialog color.
local Play = script.Music3:Play()
local Play = true
typewrite(DText, "Minion!!! Redeem yourself. Capture her now!!!")
wait(4)--Time before interpolate the camera again, change if you want.
--Disappear "You escaped":
TService:Create(script.Parent.Parent.AdditionalGui.YouEscapedLabel, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0), {TextTransparency = 1}):Play()
InterpolateCamera(CamFolder.Cam1, CamFolder.Cam2, 3)
CharName.Text = "Minion"--Character Name
CharName.TextColor3 = Color3.fromRGB(255, 255, 255)--Character name color.
DText.TextColor3 = Color3.fromRGB(255, 255, 255)--Dialog color.
local Play = script.Music4:Play()
local Play = true
typewrite(DText, "Yes sir!!! Right away!!!")
wait(4)--Time before interpolate the camera again, change if you want.
InterpolateCamera(CamFolder.Cam3, CamFolder.Cam3, 4)
CharName.Text = "Angel Girl Brianna"--Character Name
CharName.TextColor3 = Color3.fromRGB(255, 255, 255)--Character name color.
DText.TextColor3 = Color3.fromRGB(255, 255, 255)--Dialog color.
local Play = script.Music5:Play()
local Play = true
typewrite(DText, "I need to figure out how to get to the police station.")
wait(4)--Time before interpolate the camera again, change if you want.
CharName.Text = "Angel Girl Brianna"--Character Name
CharName.TextColor3 = Color3.fromRGB(255, 255, 255)--Character name color.
DText.TextColor3 = Color3.fromRGB(255, 255, 255)--Dialog color.
local Play = true
typewrite(DText, "To have the fat cat and his minion arrested!!!")
wait(4)--Time before interpolate the camera again, change if you want.
DGui.Enabled = false
FadeIn()
wait(1.5)
Camera.CameraType = Enum.CameraType.Custom
Camera.CameraSubject = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
wait(1)
FadeOut()
end
game.Workspace.CutsceneBlock.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Humanoid.Health >0 and CanPlayCutscene == true then
CanPlayCutscene = false
PlayCutscene()
end
end)