Bug with Tween Service

I have made a script to pop up some slides as an intro to my game, which, so far, works fine. However, I wanted to make the main menu appear after the slides are done and this failed to work. Does anyone know how to fix this? Thanks!
Script:

local TweenService = game:GetService("TweenService")
local player = game:GetService("Players").LocalPlayer
local firstSlide = player:WaitForChild("PlayerGui"):WaitForChild("Slides"):WaitForChild("FirstSlide")
local secondSlide = player:WaitForChild("PlayerGui"):WaitForChild("Slides"):WaitForChild("SecondSlide")
local thirdSlide = player:WaitForChild("PlayerGui"):WaitForChild("Slides"):WaitForChild("ThirdSlide")
local mainMenu = game.StarterGui.MainMenu
local mainMenuFrame = mainMenu.MenuFrame

firstSlide.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
secondSlide.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
thirdSlide.BackgroundColor3 = Color3.fromRGB(0, 0, 0)

-- Script
firstSlide.Visible = true
firstSlide.ImageTransparency = 0
wait(5)

local TweenInformation = TweenInfo.new(1, Enum.EasingStyle.Linear)

--First Slide
TweenService:Create(firstSlide, TweenInformation, {ImageTransparency = 1}):Play()
wait(2)
firstSlide:Destroy()

--Second Slide
secondSlide.ImageTransparency = 1
secondSlide.Visible = true
TweenService:Create(secondSlide, TweenInformation, {ImageTransparency = 0}):Play()
wait(5)
TweenService:Create(secondSlide, TweenInformation, {ImageTransparency = 1}):Play()
wait(2)
secondSlide:Destroy()

--Third Slide
thirdSlide.ImageTransparency = 1
thirdSlide.Visible = true
TweenService:Create(thirdSlide, TweenInformation, {ImageTransparency = 0}):Play()
wait(5)
TweenService:Create(thirdSlide, TweenInformation, {ImageTransparency = 1}):Play()
TweenService:Create(thirdSlide, TweenInformation, {BackgroundTransparency = 1}):Play()
wait(2)
thirdSlide:Destroy()

--Main Menu
mainMenu.MenuFrame.Visible = true --This is where the issue is

Workspace:
image

1 Like

What exactly is wrong, are there any errors or what?

No errors, just the menu not appearing.

Found!

local mainMenu = game.StarterGui.MainMenu

You should take not StarterGui but PlayerGui

local mainMenu = player.PlayerGui:WaitForChild("MainMenu")
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.