Click play to end cutscene and spawn in

Wdym by menu? I don’t have one.

So is there just that text and the button inside of the GUI?

image

Alright, well… we can’t just automatically assume that you have a bunch of GUIs to handle one menu. I suggest putting the whole main menu inside the same GUI. I didn’t know that.

Do you mean like this?
image

Now I am not even able to spawn because the main roblox loading screen is stuck?

Yeah, it was a core issue in the LocalScript but I fixed it now.

Also, replace the LocalScript I gave you with this one… it should fix every other problem (and you don’t have to edit it). Also, change the disabled property on “Cameras” to true for now.

EDITED LocalScript
local TweenService = game:GetService("TweenService")
local StarterGui = game:GetService("StarterGui")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local camera = game.Workspace.Camera

local coreCall do
	local MAX_RETRIES = 8

	local StarterGui = game:GetService('StarterGui')
	local RunService = game:GetService('RunService')

	function coreCall(method, ...)
		local result = {}
		for retries = 1, MAX_RETRIES do
			result = {pcall(StarterGui[method], StarterGui, ...)}
			if result[1] then
				break
			end
			RunService.Stepped:Wait()
		end
		return unpack(result)
	end
end

coreCall('SetCore', 'ResetButtonCallback', false)

local setting = {}
setting.cutsceneTime = 5;
setting.cutscenePrefix = "Test";
setting.tweenInfo = TweenInfo.new(
	setting.cutsceneTime,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out,
	0,
	false,
	0
);
setting.TweenObjectsLocation = game.Workspace;
setting.myMethod = true; -- By using my method there will be a white flash tween which will tween a new frame to fully visible, change menu frame visible to false and then load to player

local inMenu = true
local menuVisible = true
local scenePlaying = false

function spawnPlr()
	menuVisible = false -- DO NOT DELETE THIS LINE! put it after the line where you change the menu frame visible to false
	StarterGui:SetCore("ResetButtonCallback", true) -- Keep this line with the line above it
	local spawnCharacterEventFind = ReplicatedStorage:FindFirstChild("spawnPlayer")
	if spawnCharacterEventFind then
		spawnCharacterEventFind:FireServer()
	end
end

function tween(part1,part2)
	scenePlaying = true
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = part1.CFrame

	local tween = TweenService:Create(camera, setting.tweenInfo, {CFrame = part2.CFrame})
	tween:Play()

	local finishFunc
	finishFunc = tween.Completed:Connect(function()
		scenePlaying = false
		finishFunc:Disconnect()
		finishFunc = nil
	end)
	repeat task.wait() until scenePlaying == false or inMenu == false
	if inMenu == false then
		repeat task.wait() until menuVisible == false
		camera.CameraType = Enum.CameraType.Custom
	end
end

task.wait(2)

local spawnCharacterEventFind = ReplicatedStorage:FindFirstChild("spawnPlayer")
if spawnCharacterEventFind then
	spawnCharacterEventFind.Parent = nil
	spawnCharacterEvent = spawnCharacterEventFind
end

local ObjectsToTween = {}
function addTweenObject(index, obj)
	ObjectsToTween[index] = obj
end

for i,v in pairs(setting.TweenObjectsLocation:GetChildren()) do
	if v.Name:lower():find(setting.cutscenePrefix:lower()) then
		if #v.Name > #(setting.cutscenePrefix) then
			local number = v.Name:sub(#(setting.cutscenePrefix) + 1, #v.Name)
			if tonumber(number) ~= nil then
				addTweenObject(tonumber(number), v)
			end
		end
	end
end

function StartTween()
	for i,v in pairs(ObjectsToTween) do
		if not inMenu then break end
		if i < #ObjectsToTween then
			tween(v, ObjectsToTween[i + 1])
		end
	end
end

coroutine.wrap(function()
	while inMenu do
		StartTween()
		task.wait()
	end
end)()

local function PlayButton()
	if not inMenu then return end
	inMenu = false
	if setting.myMethod then
		local GUI = script.Parent:FindFirstAncestorOfClass("ScreenGui")
		if GUI then
			local FlashFrame = Instance.new("Frame")
			FlashFrame.Name = "FlashFrame"
			FlashFrame.AnchorPoint = Vector2.new(0.5, 0.5)
			FlashFrame.Position = UDim2.new(0.5, 0, 0.5, 0)
			FlashFrame.Size = UDim2.new(1, 0, 1, 0)
			FlashFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
			FlashFrame.BorderSizePixel = 0
			FlashFrame.BackgroundTransparency = 1
			FlashFrame.ZIndex = 999999999
			FlashFrame.Parent = GUI
			local Visibility = true
			local Duration = 2
			local function createNewTween(visible)
				Visibility = visible
				local newTween = TweenService:Create(
					FlashFrame, 
					TweenInfo.new(
						Duration,
						Enum.EasingStyle.Sine,
						Enum.EasingDirection.Out
					),
					{
						BackgroundTransparency = Visibility == true and 0 or 1
					}
				)
				return newTween
			end
			local TweenObj = createNewTween(true)
			TweenObj:Play()
			TweenObj.Completed:Wait()
			TweenObj = createNewTween(false)

			local MenuFrame = nil -- Must specify
			if MenuFrame then
				MenuFrame.Visible = false
			else
				GUI.Enabled = false
			end
			spawnPlr()

			TweenObj:Play()
			TweenObj.Completed:Wait()
			FlashFrame:Destroy()
			-- You can put more of your code for additional stuff if you wish

		end
		return
	end
	-- If you don't want to use my method (you can set using my method to false in the settings table, if you want), just put your own code here which changes the menu visible and other things


	spawnPlr() -- DO NOT DELETE THIS LINE! put it after the line where you change the menu frame visible to false
end

script.Parent.MouseButton1Click:Connect(PlayButton)

EDIT: Make sure to put the LocalScript inside the play button also, or else it will not work!

For some reason its stuck on this:

Did you fix the script underneath ServerScriptService?

local Players = game:GetService("Players")
local Event = ReplicatedStorage:FindFirstChild("spawnPlayer")
if not Event then
	local newEvent = Instance.new("RemoteEvent")
	newEvent.Name = "spawnPlayer"
	newEvent.Parent = ReplicatedStorage
	Event = newEvent
end

Event.OnServerEvent:Connect(function(Player)
	if Player:GetAttribute("loadedMenu") == false then
		Player:SetAttribute("loadedMenu", true)
		Player:LoadCharacter()
	end
end)

Players.PlayerAdded:Connect(function(Player) 
	Player:SetAttribute("loadedMenu", false)
	Player.CharacterAdded:Connect(function(Char)
		if Player:GetAttribute("loadedMenu") == false then
			Char:Destroy()
		end
	end)
end)```

I was making an edit for both of them, but the scripts both reverted for some reason. Here are the new scripts, everything should work now…

ServerScript (place in ServerScriptService)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Event = ReplicatedStorage:FindFirstChild("spawnPlayer")
if not Event then
	local newEvent = Instance.new("RemoteEvent")
	newEvent.Name = "spawnPlayer"
	newEvent.Parent = ReplicatedStorage
	Event = newEvent
end

Event.OnServerEvent:Connect(function(Player)
	if Player:GetAttribute("loadedMenu") == false then
		Player:SetAttribute("loadedMenu", true)
		Player:LoadCharacter()
	end
end)

Players.PlayerAdded:Connect(function(Player) 
	Player:SetAttribute("loadedMenu", false)
	task.wait(2)
	if Player.Character then
		Player.Character:Destroy()
	end
	Player.CharacterAdded:Connect(function(Char)
		if Player:GetAttribute("loadedMenu") == false then
			Char:Destroy()
		end
	end)
end)
LocalScript (place in play button)
local TweenService = game:GetService("TweenService")
local StarterGui = game:GetService("StarterGui")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local camera = game.Workspace.Camera

StarterGui:SetCore("ResetButtonCallback", false)

local setting = {}
setting.cutsceneTime = 5;
setting.cutscenePrefix = "Test";
setting.tweenInfo = TweenInfo.new(
	setting.cutsceneTime,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out,
	0,
	false,
	0
);
setting.TweenObjectsLocation = game.Workspace;
setting.myMethod = true; -- By using my method there will be a white flash tween which will tween a new frame to fully visible, change menu frame visible to false and then load to player

local inMenu = true
local menuVisible = true
local scenePlaying = false
local spawnCharacterEvent = nil

function spawnPlr()
	menuVisible = false -- DO NOT DELETE THIS LINE! put it after the line where you change the menu frame visible to false
	StarterGui:SetCore("ResetButtonCallback", true) -- Keep this line with the line above it
	local spawnCharacterEventFind = ReplicatedStorage:FindFirstChild("spawnPlayer")
	if spawnCharacterEventFind then
		spawnCharacterEventFind.Parent = nil
		spawnCharacterEventFind:FireServer()
		spawnCharacterEvent = spawnCharacterEventFind
	else
		if spawnCharacterEvent then
			spawnCharacterEvent:FireServer()
		end
	end
end

function tween(part1,part2)
	scenePlaying = true
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = part1.CFrame

	local tween = TweenService:Create(camera, setting.tweenInfo, {CFrame = part2.CFrame})
	tween:Play()

	local finishFunc
	finishFunc = tween.Completed:Connect(function()
		scenePlaying = false
		finishFunc:Disconnect()
		finishFunc = nil
	end)
	repeat task.wait() until scenePlaying == false or inMenu == false
	if inMenu == false then
		repeat task.wait() until menuVisible == false
		camera.CameraType = Enum.CameraType.Custom
	end
end

task.wait(2)

local spawnCharacterEventFind = ReplicatedStorage:FindFirstChild("spawnPlayer")
if spawnCharacterEventFind then
	spawnCharacterEventFind.Parent = nil
	spawnCharacterEvent = spawnCharacterEventFind
end

local ObjectsToTween = {}
function addTweenObject(index, obj)
	ObjectsToTween[index] = obj
end

for i,v in pairs(setting.TweenObjectsLocation:GetChildren()) do
	if v.Name:lower():find(setting.cutscenePrefix:lower()) then
		if #v.Name > #(setting.cutscenePrefix) then
			local number = v.Name:sub(#(setting.cutscenePrefix) + 1, #v.Name)
			if tonumber(number) ~= nil then
				addTweenObject(tonumber(number), v)
			end
		end
	end
end

function StartTween()
	for i,v in pairs(ObjectsToTween) do
		if not inMenu then break end
		if i < #ObjectsToTween then
			tween(v, ObjectsToTween[i + 1])
		end
	end
end

coroutine.wrap(function()
	while inMenu do
		StartTween()
		task.wait()
	end
end)()

local function PlayButton()
	if not inMenu then return end
	inMenu = false
	if setting.myMethod then
		local GUI = script.Parent:FindFirstAncestorOfClass("ScreenGui")
		if GUI then
			local FlashFrame = Instance.new("Frame")
			FlashFrame.Name = "FlashFrame"
			FlashFrame.AnchorPoint = Vector2.new(0.5, 0.5)
			FlashFrame.Position = UDim2.new(0.5, 0, 0.5, 0)
			FlashFrame.Size = UDim2.new(1, 0, 1, 0)
			FlashFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
			FlashFrame.BorderSizePixel = 0
			FlashFrame.BackgroundTransparency = 1
			FlashFrame.ZIndex = 999999999
			FlashFrame.Parent = GUI
			local Visibility = true
			local Duration = 2
			local function createNewTween(visible)
				Visibility = visible
				local newTween = TweenService:Create(
					FlashFrame, 
					TweenInfo.new(
						Duration,
						Enum.EasingStyle.Sine,
						Enum.EasingDirection.Out
					),
					{
						BackgroundTransparency = Visibility == true and 0 or 1
					}
				)
				return newTween
			end
			local TweenObj = createNewTween(true)
			TweenObj:Play()
			TweenObj.Completed:Wait()
			TweenObj = createNewTween(false)

			local MenuFrame = nil -- Must specify
			if MenuFrame ~= nil then
				MenuFrame.Visible = false
			else
				MenuFrame = GUI
				GUI.Enabled = false
			end
			spawnPlr()

			TweenObj:Play()
			TweenObj.Completed:Wait()
			FlashFrame:Destroy()
			-- You can put more of your code for additional stuff if you wish

		end
		return
	end
	-- If you don't want to use my method (you can set using my method to false in the settings table, if you want), just put your own code here which changes the menu visible and other things


	spawnPlr() -- DO NOT DELETE THIS LINE! put it after the line where you change the menu frame visible to false
end

script.Parent.MouseButton1Click:Connect(PlayButton)
1 Like

Ok, I changed the scripts. Do I add a remote event into ReplicatedStorage?

You don’t have to, the script automatically creates it if not found.

I am still stuck on the main roblox loading screen. I don’t know what to do?

Ok so, I published the game to test it. When I clicked it it removed the gui and closed the cutscene. Then it switched to the normal player camera view but my character never spawned. Than after a few seconds it wen back to the cutscene view but the gui is still gone.

Here is the link to the game if you want to see what I mean: 🏕️ Camp Formont [Beta] - Roblox

Alright… new scripts again

ServerScript
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Event = ReplicatedStorage:FindFirstChild("spawnPlayer")
if not Event then
	local newEvent = Instance.new("RemoteEvent")
	newEvent.Name = "spawnPlayer"
	newEvent.Parent = ReplicatedStorage
	Event = newEvent
end

Event.OnServerEvent:Connect(function(Player)
	if Player:GetAttribute("loadedMenu") == false then
		Player:SetAttribute("loadedMenu", true)
		pcall(function()
			for i,v in pairs(Player.PlayerGui:GetChildren()) do
				v.ResetOnSpawn = false
			end
		end)
		task.wait(0.5)
		Player:LoadCharacter(true)
	end
end)

Players.PlayerAdded:Connect(function(Player) 
	Player:SetAttribute("loadedMenu", false)
	wait(2)
	if Player.Character then
		Player.Character:Destroy()
	end
	Player.CharacterAdded:Connect(function(Char)
		if Player:GetAttribute("loadedMenu") == false then
			Char:Destroy()
		end
	end)
end)
LocalScript
local TweenService = game:GetService("TweenService")
local StarterGui = game:GetService("StarterGui")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local camera = game.Workspace.Camera

local coreCall do
	local MAX_RETRIES = 8

	local StarterGui = game:GetService('StarterGui')
	local RunService = game:GetService('RunService')

	function coreCall(method, ...)
		local result = {}
		for retries = 1, MAX_RETRIES do
			result = {pcall(StarterGui[method], StarterGui, ...)}
			if result[1] then
				break
			end
			RunService.Stepped:Wait()
		end
		return unpack(result)
	end
end

coreCall('SetCore', 'ResetButtonCallback', false)

local setting = {}
setting.cutsceneTime = 5;
setting.cutscenePrefix = "Test";
setting.tweenInfo = TweenInfo.new(
	setting.cutsceneTime,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out,
	0,
	false,
	0
);
setting.TweenObjectsLocation = game.Workspace;
setting.myMethod = true; -- By using my method there will be a white flash tween which will tween a new frame to fully visible, change menu frame visible to false and then load to player

local inMenu = true
local menuVisible = true
local scenePlaying = false

function spawnPlr()
	menuVisible = false -- DO NOT DELETE THIS LINE! put it after the line where you change the menu frame visible to false
	StarterGui:SetCore("ResetButtonCallback", true) -- Keep this line with the line above it
	local spawnCharacterEventFind = ReplicatedStorage:FindFirstChild("spawnPlayer")
	if spawnCharacterEventFind then
		spawnCharacterEventFind:FireServer()
	end
end

function tween(part1,part2)
	scenePlaying = true
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = part1.CFrame

	local tween = TweenService:Create(camera, setting.tweenInfo, {CFrame = part2.CFrame})
	tween:Play()

	local finishFunc
	finishFunc = tween.Completed:Connect(function()
		scenePlaying = false
		finishFunc:Disconnect()
		finishFunc = nil
	end)
	repeat task.wait() until scenePlaying == false or inMenu == false
	if inMenu == false then
		pcall(function()
			tween:Stop()
		end)
		repeat task.wait() until menuVisible == false
		camera.CameraType = Enum.CameraType.Custom
	end
end

task.wait(2)

local ObjectsToTween = {}
function addTweenObject(index, obj)
	ObjectsToTween[index] = obj
end

for i,v in pairs(setting.TweenObjectsLocation:GetChildren()) do
	if v.Name:lower():find(setting.cutscenePrefix:lower()) then
		if #v.Name > #(setting.cutscenePrefix) then
			local number = v.Name:sub(#(setting.cutscenePrefix) + 1, #v.Name)
			if tonumber(number) ~= nil then
				addTweenObject(tonumber(number), v)
			end
		end
	end
end

function StartTween()
	for i,v in pairs(ObjectsToTween) do
		if not inMenu then break end
		if i < #ObjectsToTween then
			tween(v, ObjectsToTween[i + 1])
		end
	end
end

coroutine.wrap(function()
	while inMenu do
		StartTween()
		task.wait()
	end
end)()

local function PlayButton()
	if not inMenu then return end
	inMenu = false
	if setting.myMethod then
		local GUI = script.Parent:FindFirstAncestorOfClass("ScreenGui")
		if GUI then
			local FlashFrame = Instance.new("Frame")
			FlashFrame.Name = "FlashFrame"
			FlashFrame.AnchorPoint = Vector2.new(0.5, 0.5)
			FlashFrame.Position = UDim2.new(0.5, 0, 0.5, 0)
			FlashFrame.Size = UDim2.new(1, 0, 1, 0)
			FlashFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
			FlashFrame.BorderSizePixel = 0
			FlashFrame.BackgroundTransparency = 1
			FlashFrame.ZIndex = 999999999
			FlashFrame.Parent = GUI
			local Visibility = true
			local Duration = 2
			local function createNewTween(visible)
				Visibility = visible
				local newTween = TweenService:Create(
					FlashFrame, 
					TweenInfo.new(
						Duration,
						Enum.EasingStyle.Sine,
						Enum.EasingDirection.Out
					),
					{
						BackgroundTransparency = Visibility == true and 0 or 1
					}
				)
				return newTween
			end
			local TweenObj = createNewTween(true)
			TweenObj:Play()
			TweenObj.Completed:Wait()
			TweenObj = createNewTween(false)

			local MenuFrame = nil -- Must specify
			spawnPlr()
			if MenuFrame then
				MenuFrame.Visible = false
			else
				for i,v in pairs(GUI:GetChildren()) do
					if v ~= FlashFrame then
						pcall(function()
							v.Visible = false
						end)
					end
				end
				MenuFrame = GUI
			end

			TweenObj:Play()
			TweenObj.Completed:Wait()
			FlashFrame:Destroy()
			GUI.Enabled = false
			for i,v in pairs(GUI:GetChildren()) do
				pcall(function()
					v.Visible = true
				end)
			end
			-- You can put more of your code for additional stuff if you wish

		end
		return
	end
	-- If you don't want to use my method (you can set using my method to false in the settings table, if you want), just put your own code here which changes the menu visible and other things


	spawnPlr() -- DO NOT DELETE THIS LINE! put it after the line where you change the menu frame visible to false
end

script.Parent.MouseButton1Click:Connect(PlayButton)
1 Like

What is this?:
image

It did the same thing like before. Deleted the gui and spawns you as an invisible player that can’t move. Then it goes back to the cutscene.

So your GUI has the property ResetOnSpawn enabled which keeps causing that to happen. You don’t have to change it now because I made the proper fixes to the script, I mean you can but… Here are the new scripts

ServerScript
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Event = ReplicatedStorage:FindFirstChild("spawnPlayer")
if not Event then
	local newEvent = Instance.new("RemoteEvent")
	newEvent.Name = "spawnPlayer"
	newEvent.Parent = ReplicatedStorage
	Event = newEvent
end

Event.OnServerEvent:Connect(function(Player)
	if Player:GetAttribute("loadedMenu") == false then
		Player:SetAttribute("loadedMenu", true)
		Player.Character.Parent = game.Workspace
	end
end)

Players.PlayerAdded:Connect(function(Player) 
	Player:SetAttribute("loadedMenu", false)
	task.wait(2)
	if Player.Character then
		Player.Character.Parent = ReplicatedStorage
	end
	Player.CharacterAdded:Connect(function(Char)
		if Player:GetAttribute("loadedMenu") == false then
			Char.Parent = ReplicatedStorage
		end
	end)
end)
LocalScript
local TweenService = game:GetService("TweenService")
local StarterGui = game:GetService("StarterGui")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local camera = game.Workspace.Camera

local coreCall do
	local MAX_RETRIES = 8

	local StarterGui = game:GetService('StarterGui')
	local RunService = game:GetService('RunService')

	function coreCall(method, ...)
		local result = {}
		for retries = 1, MAX_RETRIES do
			result = {pcall(StarterGui[method], StarterGui, ...)}
			if result[1] then
				break
			end
			RunService.Stepped:Wait()
		end
		return unpack(result)
	end
end

coreCall('SetCore', 'ResetButtonCallback', false)

local setting = {}
setting.cutsceneTime = 5;
setting.cutscenePrefix = "Test";
setting.tweenInfo = TweenInfo.new(
	setting.cutsceneTime,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out,
	0,
	false,
	0
);
setting.TweenObjectsLocation = game.Workspace;
setting.myMethod = true; -- By using my method there will be a white flash tween which will tween a new frame to fully visible, change menu frame visible to false and then load to player

local inMenu = true
local menuVisible = true
local scenePlaying = false

function spawnPlr()
	menuVisible = false -- DO NOT DELETE THIS LINE! put it after the line where you change the menu frame visible to false
	StarterGui:SetCore("ResetButtonCallback", true) -- Keep this line with the line above it
	local spawnCharacterEventFind = ReplicatedStorage:FindFirstChild("spawnPlayer")
	if spawnCharacterEventFind then
		spawnCharacterEventFind:FireServer()
	end
end

function tween(part1,part2)
	scenePlaying = true
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = part1.CFrame

	local tween = TweenService:Create(camera, setting.tweenInfo, {CFrame = part2.CFrame})
	tween:Play()

	local finishFunc
	finishFunc = tween.Completed:Connect(function()
		scenePlaying = false
		finishFunc:Disconnect()
		finishFunc = nil
	end)
	repeat task.wait() until scenePlaying == false or inMenu == false
	if inMenu == false then
		pcall(function()
			tween:Stop()
		end)
		repeat task.wait() until menuVisible == false
		camera.CameraType = Enum.CameraType.Custom
	end
end

task.wait(2)

local ObjectsToTween = {}
function addTweenObject(index, obj)
	ObjectsToTween[index] = obj
end

for i,v in pairs(setting.TweenObjectsLocation:GetChildren()) do
	if v.Name:lower():find(setting.cutscenePrefix:lower()) then
		if #v.Name > #(setting.cutscenePrefix) then
			local number = v.Name:sub(#(setting.cutscenePrefix) + 1, #v.Name)
			if tonumber(number) ~= nil then
				addTweenObject(tonumber(number), v)
			end
		end
	end
end

function StartTween()
	for i,v in pairs(ObjectsToTween) do
		if not inMenu then break end
		if i < #ObjectsToTween then
			tween(v, ObjectsToTween[i + 1])
		end
	end
end

coroutine.wrap(function()
	while inMenu do
		StartTween()
		task.wait()
	end
end)()

local function PlayButton()
	if not inMenu then return end
	inMenu = false
	if setting.myMethod then
		local GUI = script.Parent:FindFirstAncestorOfClass("ScreenGui")
		if GUI then
			local FlashFrame = Instance.new("Frame")
			FlashFrame.Name = "FlashFrame"
			FlashFrame.AnchorPoint = Vector2.new(0.5, 0.5)
			FlashFrame.Position = UDim2.new(0.5, 0, 0.5, 0)
			FlashFrame.Size = UDim2.new(1, 0, 1, 0)
			FlashFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
			FlashFrame.BorderSizePixel = 0
			FlashFrame.BackgroundTransparency = 1
			FlashFrame.ZIndex = 999999999
			FlashFrame.Parent = GUI
			local Visibility = true
			local Duration = 2
			local function createNewTween(visible)
				Visibility = visible
				local newTween = TweenService:Create(
					FlashFrame, 
					TweenInfo.new(
						Duration,
						Enum.EasingStyle.Sine,
						Enum.EasingDirection.Out
					),
					{
						BackgroundTransparency = Visibility == true and 0 or 1
					}
				)
				return newTween
			end
			local TweenObj = createNewTween(true)
			TweenObj:Play()
			TweenObj.Completed:Wait()
			TweenObj = createNewTween(false)

			local MenuFrame = nil -- Must specify
			spawnPlr()
			if MenuFrame then
				MenuFrame.Visible = false
			else
				for i,v in pairs(GUI:GetChildren()) do
					if v ~= FlashFrame then
						pcall(function()
							v.Visible = false
						end)
					end
				end
				MenuFrame = GUI
			end

			TweenObj:Play()
			TweenObj.Completed:Wait()
			FlashFrame:Destroy()
			GUI.Enabled = false
			for i,v in pairs(GUI:GetChildren()) do
				pcall(function()
					v.Visible = true
				end)
			end
			-- You can put more of your code for additional stuff if you wish

		end
		return
	end
	-- If you don't want to use my method (you can set using my method to false in the settings table, if you want), just put your own code here which changes the menu visible and other things


	spawnPlr() -- DO NOT DELETE THIS LINE! put it after the line where you change the menu frame visible to false
end

script.Parent.MouseButton1Click:Connect(PlayButton)
1 Like

Alright, let me test this real fast.