What I’m Attempting
I’m attempting to make a Cutscene toggle button. What I mean by this is…
When you click a button to disable cutscenes… it stays disabled on a respawn or character added.
Issues
No matter what I try, I can never seem to keep the cutscenes disabled after a respawn.
Solutions
I’ve tried going through the client with a PlayerGui Removal.
I’ve tried using a BoolValue.
I’m completely lost.
Photos
This is where cutscenes are located and the folder they are duplicated to, this is the folder to play the said cutscenes.
This is me using the ROBLOX Studio Client to remove the folder, as you see this part works.
This is when I respawn in the same game. The folder returns. I know why it returns, it’s because it’s in StarterGui but I don’t know of any other way around this.
The Scripts
Main Cutscene Script Player, the script that plays the cutscenes.
--Made By MillerrIAm
-------------------Variables------------------
Cutscene = game:GetService("ServerStorage").Cutscenes
FixCam = game:GetService("ServerStorage").ExtraItems
Event = game.ReplicatedStorage.GUIEvents.CutscenePlayer
Enabled = false
------------------Main Script------------------
Event.OnServerEvent:Connect(function(plr,Play,argument)
if game.StarterGui:FindFirstChild("Cutscenes") then
local args = {argument}
if Play == "On" then
if not plr.PlayerGui.Cutscenes:FindFirstChild(""..argument) then
for i,x in pairs (game.Players:GetPlayers()) do
Cutscene:FindFirstChild(""..argument):Clone().Parent = x.PlayerGui.Cutscenes
x.PlayerGui.Cutscenes:FindFirstChild(""..argument).Disabled = false
wait(0.5)
end
else
local cut = plr.PlayerGui.Cutscenes:FindFirstChild(""..argument)
for i,x in pairs (game.Players:GetPlayers()) do
x.PlayerGui.Cutscenes:FindFirstChild(""..argument).Disabled = true
x.PlayerGui.Cutscenes:FindFirstChild(""..argument):Destroy()
i = FixCam.FixCamera
i.Disabled = false
i:Clone().Parent = x.PlayerGui
end
cut:Destroy()
end
elseif Play == "Off" then
for i,x in pairs (game.Players:GetPlayers()) do
x.PlayerGui.Cutscenes:ClearAllChildren()
i = FixCam.FixCamera
i.Disabled = false
i:Clone().Parent = x.PlayerGui
end
elseif Play == "Finished" then
local Input = args[1]
assert(type(Input) == "string","Cutscene Invalid - Not a String")
local Scene = assert(plr.PlayerGui.Cutscenes:FindFirstChild(Input), "Cutscene not Found")
Scene:Destroy()
print("Scene Destroyed")
end
end
end)
Event Script Idea, not using as it didn't work.
--Made By MillerrIAm
-------------Variables------------
Event = game.ReplicatedStorage.ExtraEvents.CutsceneAllowance
------------Main Script------------
Event.OnServerEvent:Connect(function(plr,Checking)
if Checking == "True" then
local startergui = game.StarterGui
local playergui = plr.PlayerGui
if playergui:FindFirstChild("Cutscenes") then
plr.PlayerGui.Cutscenes:Destroy()
elseif not playergui:FindFirstChild("Cutscenes") then
local Folder = Instance.new("Folder")
Folder.Name = "Cutscenes"
Folder.Parent = plr.PlayerGui
end
end
end)
GUI Button Local Script
--Made By MillerrIAm
------------Main Script------------
script.Parent.MouseButton1Click:Connect(function()
if game.Workspace.CutsceneValue.Value == true then
game.Workspace.CutsceneValue.Value = false
script.Parent.Text = "Cutscenes: On"
if not script.Parent.Parent.Parent.Parent.Parent:FindFirstChild("Cutscenes") then
local Folder = Instance.new("Folder")
Folder.Name = "Cutscenes"
Folder.Parent = script.Parent.Parent
end
else
game.Workspace.CutsceneValue.Value = true
script.Parent.Text = "Cutscenes: Off"
script.Parent.Parent.Parent.Parent.Parent.Cutscenes:Destroy()
end
end)
Thank you in advance for any help you can give me.