Images and Text not Appearing when scripted

Hello!

In my script, I wrote where it detects if the player has joined, the plays a sound (works correctly). But, after that the script just stops. My main goal was to make and image and text appear after a second.

I added the print lines and that doesn’t print when testing. Any Solutions?

Script

local Logo = script.Parent.PlaneyProductionsLogo
local Caption1 = script.Parent.Caption1

Logo.Visible = false
Caption1.Visible = false


game.Players.PlayerAdded:Connect(function(plr)
	Sound:Play()
	print("plr")
	wait(1)
	print("second")
	Logo.Visible = true
	Caption1.Visible = true
	
end)

I would like you to specify what kind of script you’re using since UI is related to the user so in that case you would have to use a local script. If you want the UI to be visible to the server you use a remote event to fire it to the server

...

UI has to be inside a player’s PlayerGui

you access that players UI before you make any interaction like .visible

place the ui in StarterGui make any changes like disabling visibility .visible = untick

then

game.Players.PlayerAdded:Connect(function(plr)
    local plrgui=plr.PlayerGui
    local screengui=plrgui[screen gui name]
    local logo= screengui[logo name]
    logo.visible=true
end)

this script is under the gui?!
you don’t need the playeradded function then

How would I do that?
I changed the script but I am not sure if it is correct.

Script:

local Sound = script.Parent.Parent.ScarySound
local Logo = script.Parent.PlaneyProductionsLogo
local Caption1 = script.Parent.Caption1

Logo.Visible = false
Caption1.Visible = false

game.Players.PlayerAdded:Connect(function(plr)
	local plrgui = plr.PlayerGui
	local screengui = plrgui.PlayScreen
	local logo = screengui.LOGO
	logo.visible = true
end)

Wait never mind, i fixed the issue by putting the visible script out of the function.

Script:

local Sound = script.Parent.Parent.ScarySound
local Logo = script.Parent.PlaneyProductionsLogo
local Caption1 = script.Parent.Caption1

Logo.Visible = false
Caption1.Visible = false


game.Players.PlayerAdded:Connect(function(plr)
	Sound:Play()
	
end)

wait(1)

Logo.Visible = true
Caption1.Visible = true