Cutscenes clashing with each other

I have made a cutscene script that upon activation spawns in the camera parts for the cutscene to follow. I have discovered that (obviously) if two players were to use it at the same time, they would both have the same view, which is not what I wanted.

tween(game.Workspace.Cam1,game.Workspace.Cam2,2)
tween(game.Workspace.Cam2,game.Workspace.Cam3,3)
tween(game.Workspace.Cam3,game.Workspace.Cam4,1)
tween(game.Workspace.Cam4,game.Workspace.Cam5,3)

I have a script that spawns in the Camera parts, but since they’re in workspace, every player trying to activate the move will have the first players perspective.

How would I go about making the cutscene for one player only? would I have to create different parts/cameras for each player?

Based on the information given I will assume this is being ran through a server script. The solution, if the case, will be to run this through a local script. The cameras will only show the client using it and prevent your issue.

1 Like

Do you not do this in the server , do this in the Client that is by doing this in a Local Script place in StarterCharacterScripts or any other local services.

1 Like

Use a LocalScript. This way the sequence will be played locally for each client, and should be smoother (due to network delay).

A way to do this whilst having some server authority wold be to use a serverscript that listens to a part’s Touched event, checks if the touched part is a player’s character, and :FireClient() to the player that touched the part. The player listens to the remote and plays the sequence (locally) whenever it gets triggered.
Here is an article explaining RemoteEvents (server → client): Custom Events and Callbacks | Documentation - Roblox Creator Hub

Are you waiting for every tween to end before starting a new one? This could be a cause for the tweens clashing with each other.

1 Like

my bad, i forgot to specify that I am indeed using a local script. My problem is that since it is spawning in parts relative to the player that act as the camera, if another player were to use it at the same time, it would use the parts relative to the first player as the cutscene cameras.

https://streamable.com/d2r2hc
here is a video of what happens, I realise that I hadn’t explained it the best, so hopefully this video helps clear things up.

1 Like

Hi, so if I understand this correctly the animation has to play for every player around their character?
Could you share the LocalScript that creates the tween?

Not quite.
that is the local script for the cutscene.

local Tool = script.Parent
local Debounce = false
local TweenService = game:GetService(“TweenService”)
local camera = game.Workspace.Camera

function tween(part1,part2,cutsceneTime)

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

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

Tool.Activated:connect(function()
if not Debounce then
Debounce = true
wait(.1)
tween(game.Workspace.Cam1,game.Workspace.Cam2,2)
tween(game.Workspace.Cam2,game.Workspace.Cam3,3)
tween(game.Workspace.Cam3,game.Workspace.Cam4,1)
tween(game.Workspace.Cam4,game.Workspace.Cam5,3)
end
wait(10)
Debounce = false
end)

and this is part of the script that inserts the camera.

local c1 = game.ReplicatedStorage.Breathings.DeadcalmCam:WaitForChild(“Cam1”):Clone()
c1.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(0,5,-40) * CFrame.Angles(math.rad(-180),0,math.rad(180))
c1.Parent = workspace

local c2 = game.ReplicatedStorage.Breathings.DeadcalmCam:WaitForChild(“Cam2”):Clone()
c2.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(0,2,-10) * CFrame.Angles(math.rad(-180),0,math.rad(180))
c2.Parent = workspace

local c3 = game.ReplicatedStorage.Breathings.DeadcalmCam:WaitForChild(“Cam3”):Clone()
c3.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(0,1,-5) * CFrame.Angles(math.rad(-180),0,math.rad(180))
c3.Parent = workspace

local c4 = game.ReplicatedStorage.Breathings.DeadcalmCam:WaitForChild(“Cam4”):Clone()
c4.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(0,1,2) * CFrame.Angles(math.rad(180),math.rad(180),math.rad(-180))
c4.Parent = workspace

local c5 = game.ReplicatedStorage.Breathings.DeadcalmCam:WaitForChild(“Cam5”):Clone()
c5.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(0,5,20) * CFrame.Angles(math.rad(180),math.rad(180),math.rad(-180))
c5.Parent = workspace

basically, if a player were to use the move and trigger their cutscene at the same time as another player, then the cutscene will use whichever camera part was inserted first. I am trying to make it so that this doesn’t occur and that there will be no clashing of cutscenes.

A way to prevent this is to use some sort of identifier to know which part is from what player. This could be a StringValue inside of the part with the player’s name or by parenting the part to the player’s character.

2 Likes

thanks for the help, and sorry for dragging this out

2 Likes