Start Menu Code not Running

So I’m trying to make one of those professional start menus, where it shows the game logo, warning, etc. I’m trying to use TweenService To make the images and text smoothly appear and disappear. Unfortunately, this script is working, and I really don’t know why. There are no errors in the output, other than some blue text marking line 40.

local menu = script.Parent
local background = menu.Background

local logo = background.Logo
local headphones = background.Headphones

local loading = background.Loading

local warningDesc = background.WarningDesc
local warning = background.Warning
local headphoneTip = background.HeadphoneTip

local TweenService = game:GetService("TweenService")

--Logo Tween

local time = 1 
local logoTween = TweenService:Create(logo, TweenInfo.new(time), {ImageTransparency = 0})

local time = 1 
local logoTween2 = TweenService:Create(logo, TweenInfo.new(time), {ImageTransparency = 1})

--Headphone Tween

local time = 1 
local headphoneTween = TweenService:Create(headphones, TweenInfo.new(time), {ImageTransparency = 0})

local time = 1 
local headphoneTween2 = TweenService:Create(headphoneTip, TweenInfo.new(time), {TextTransparency = 0})

local time = 1 
local headphoneTween3 = TweenService:Create(headphones, TweenInfo.new(time), {ImageTransparency = 1})

local time = 1 
local headphoneTween4 = TweenService:Create(headphoneTip, TweenInfo.new(time), {TextTransparency = 1})

--Warning Tween

local time = 1 
local warningTween = TweenService:Create(warning, TweenInfo.new(time), {ImageTransparency = 0})

local time = 1
local warningTween1 = TweenService:Create(warningDesc, TweenInfo.new(time), {TextTransparency = 0})

local time = 1 
local warningTween2 = TweenService:Create(warning, TweenInfo.new(time), {ImageTransparency = 1})

local time = 1 
local warningTween3 = TweenService:Create(warningDesc, TweenInfo.new(time), {TextTransparency = 1})

--Background

local time = 1 
local backgroundTween = TweenService:Create(background, TweenInfo.new(time), {ImageTransparency = 1})

--Function

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
	task.wait(5)
	print("Logo")
	logoTween:Play()
	task.wait(2)
	logoTween2:Play()
	task.wait(2)
	print("Headphone")
	headphoneTween:Play()
	headphoneTween2:Play()
	task.wait(2)
	headphoneTween3:Play()
	headphoneTween4:Play()
	task.wait(2)
	print("Warning")
	warningTween:Play()
	warningTween1:Play()
	task.wait(2)
	warningTween2:Play()
	warningTween3:Play()
	task.wait(2)
	print("Background")
	backgroundTween:Play()	
end)

I’m not so good with tweens, so I used a snippet of code from an older devforum post. Here is the GUI hierarchy:

image

Could anyone explain why this isn’t working? Also, if you have any tips on making the code more efficient, please share them.

It looks like your PlayerAdded event isn’t firing, probably because you are using a local script.

Luckily, because of that same issue, you can remove the player added function, and just have the code run after you set up your tweens, because the local script will only execute it’s code when the player joins.

I noticed as well that you are trying to change the image transparency property on a text label, which will inevitably throw an error here:

I hope I have fixed these issues in the below (ImageTransparency → TextTransparency Like the other warning labels, forgive me if that’s wrong)

Tweaked Code
local menu = script.Parent
local background = menu.Background

local logo = background.Logo
local headphones = background.Headphones

local loading = background.Loading

local warningDesc = background.WarningDesc
local warning = background.Warning
local headphoneTip = background.HeadphoneTip

local TweenService = game:GetService("TweenService")

--Logo Tween

local time = 1 
local logoTween = TweenService:Create(logo, TweenInfo.new(time), {ImageTransparency = 0})

local time = 1 
local logoTween2 = TweenService:Create(logo, TweenInfo.new(time), {ImageTransparency = 1})

--Headphone Tween

local time = 1 
local headphoneTween = TweenService:Create(headphones, TweenInfo.new(time), {ImageTransparency = 0})

local time = 1 
local headphoneTween2 = TweenService:Create(headphoneTip, TweenInfo.new(time), {TextTransparency = 0})

local time = 1 
local headphoneTween3 = TweenService:Create(headphones, TweenInfo.new(time), {ImageTransparency = 1})

local time = 1 
local headphoneTween4 = TweenService:Create(headphoneTip, TweenInfo.new(time), {TextTransparency = 1})

--Warning Tween

local time = 1 
local warningTween = TweenService:Create(warning, TweenInfo.new(time), {TextTransparency = 0})

local time = 1
local warningTween1 = TweenService:Create(warningDesc, TweenInfo.new(time), {TextTransparency = 0})

local time = 1 
local warningTween2 = TweenService:Create(warning, TweenInfo.new(time), {TextTransparency = 1})

local time = 1 
local warningTween3 = TweenService:Create(warningDesc, TweenInfo.new(time), {TextTransparency = 1})

--Background

local time = 1 
local backgroundTween = TweenService:Create(background, TweenInfo.new(time), {ImageTransparency = 1})

task.wait(5)
print("Logo")
logoTween:Play()
task.wait(2)
logoTween2:Play()
task.wait(2)
print("Headphone")
headphoneTween:Play()
headphoneTween2:Play()
task.wait(2)
headphoneTween3:Play()
headphoneTween4:Play()
task.wait(2)
print("Warning")
warningTween:Play()
warningTween1:Play()
task.wait(2)
warningTween2:Play()
warningTween3:Play()
task.wait(2)
print("Background")
backgroundTween:Play()	
1 Like

Thanks so much. Highly appreciate it!

1 Like