I made a little cutscene in the game so the players dont over flow over them I want when a player touches that part they cant see the other players for a breif period of time like 5 seconds
1 Like
Parent the other player’s character to ReplicatedStorage or somewhere outside Workspace.
Part.Touched:Connect(function(Part)
if Part.Parent:FindFirstChild("Humanoid") then
for i,Player in pairs(game.Players:GetPlayers()) do
if Player ~= game.Players:GetPlayerFromCharacter(Part.Parent) then
for i,part in pairs(Player.Character:GetChildren()) do
if part.Transparency then
task.spawn(function()
part.Transparency = 1
task.wait(10) -- Change to whatever
part.Transparency = 0
end)
end
end
end
end
end
end)
4 Likes
Set up a RemoteEvent
named CutsceneInvisible
in ReplicatedStorage
.
Set up a server-sided script:
--change part here
part.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if not player then return end
game.ReplicatedStorage.CutsceneInvisible:FireClient(player)
end)
Set up a client-sided script (StarterPlayerScripts):
local function checkDescendant(v)
return v.Name ~= "HumanoidRootPart" and (v:IsA("BasePart") or v:IsA("Decal"))
end
game:GetService("ReplicatedStorage"):WaitForChild("CutsceneInvisible").OnClientEvent:Connect(function()
for _, v in game.Players:GetPlayers() do
if v == game.Players.LocalPlayer then continue end
for _, d in v.Character:GetDescendants() do
if not checkDescendant(d) then continue end
d.Transparency = 1
if d:IsA("BasePart") then d.CanCollide = false end
end
end
task.wait(5)
for _, v in game.Players:GetPlayers() do
if v == game.Players.LocalPlayer then continue end
for _, d in v.Character:GetDescendants() do
if not checkDescendant(d) then continue end
d.Transparency = 0
if d:IsA("BasePart") then d.CanCollide = true end
end
end
end)
2 Likes
For cutscenes I like to use a clone of the player’s character and their actual character somewhere else in a box out of view. Just make sure the character has the archivable property enabled.
1 Like