I’ve created a script that plays a cutscene after an event is launched. The cutscene plays some music, and shows some guis. But when I try to test this with multiple people, every player can hear the music and see the guis show up, even when I don’t want them to. I can find a workaround for the guis, but if there are two people playing the cutscene at the same time, the music plays twice.
The script is inside a LocalScript, so it should run only for the player. To fire the event, I used FireAllClients().
game.ReplicatedStorage.MapWonEvent.WorkChosen.OnClientEvent:Connect(function()
game.Players.LocalPlayer.PlayerGui.BackGui.Frame.Visible = false
game.Players.LocalPlayer.PlayerGui.BackGui.BackClicker.Visible = false
TweenService:Create(game.Players.LocalPlayer.PlayerGui.FadeGui.Frame,TweenInfo.new(1.5,Enum.EasingStyle.Linear),{BackgroundTransparency = 0}):Play()
--This fade effect also plays multiple times when multiple people are trying to use it
task.wait(1.5)
TweenService:Create(game.Players.LocalPlayer.PlayerGui.FadeGui.Frame,TweenInfo.new(0.5,Enum.EasingStyle.Linear),{BackgroundTransparency = 1}):Play()
local camera = game.Workspace.CurrentCamera
local playerPositions = game.Workspace.WorkMap.PlayerPositions
local cameraHolder = game.Workspace.WorkMap.PlayerCams
game.Lighting.ClockTime = 9
game.Workspace.Work:Play() -- The sound I am trying to play
Controls:Disable() -- Disables the player's controls
camera.CFrame = cameraHolder.Camera1.CFrame
task.wait(3)
camera.CFrame = cameraHolder.Camera2.CFrame
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = playerPositions.PlayerPos1.CFrame
game.Players.LocalPlayer.Character.Humanoid:MoveTo(playerPositions.PlayerPos2.Position)
task.wait(2.2)
textLabel.BorderColor3 = Color3.fromHSV(0, 0, 1)
textLabel.TextColor3 = Color3.fromHSV(0, 0, 1)
textLabel.Visible = true
typewrite(textLabel, "General!", 0.04) -- The text overlaps when multiple players are using it, so you cannot read this at all
task.wait(0.3)
textLabel.Visible = false
task.wait(2)
textLabel.Visible = true
textLabel.BorderColor3 = Color3.fromHSV(0.333333, 1, 0.301915)
textLabel.TextColor3 = Color3.fromHSV(0.333333, 1, 0.301915)
typewrite(textLabel, "Solder, why aren't you in rank?", 0.05) --For example, this message might be playing for one player, while the last one is playing for another, but both players can see them at the same time
task.wait(1)
textLabel.BorderColor3 = Color3.fromHSV(0, 0, 1)
textLabel.TextColor3 = Color3.fromHSV(0, 0, 1)
typewrite(textLabel, "What's going on?", 0.05)
task.wait(1)
textLabel.BorderColor3 = Color3.fromHSV(0.333333, 1, 0.301915)
textLabel.TextColor3 = Color3.fromHSV(0.333333, 1, 0.301915)
typewrite(textLabel, "I briefed all of you this morning, now grab a weapon and get out there!", 0.04)
end
end)
Does anybody know why multiple people can see this cutscene?