PlayerGui and StarterGui - Differences

Got it! Well, I did some modifications as you said and followed the guide, and the result was this:

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
	print(player.UserId, player.Name, player.DisplayName, " joined the experience")
	
	local TextLabel = script.Parent.Frame
	TextLabel.BackgroundTransparency = 1
	TextLabel.Text = "Loading"
	TextLabel.TextScaled = true
	
	task.wait(5)
	
	for index=0.1,1,1 do
		TextLabel.BackgroundTransparency = index -- It is going to fade the frame background transparency in milliseconds.
		task.wait(0.01)
	end
	
	task.wait(1.75)
	
	print("Loaded.")
	
	local days = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}
	
	print("Today is " .. days[5])
end)

(Full code line of the script to understand the situation)

Once making the changes and played at Studio, nothing changed really… Not sure if it is missing other parts to make it 100% functional…

1 Like

To note, it does not show as well in the Output tab, even with the information needed to be printed.

What exactly is the script parented to?

1 Like

The script is parented to the testing frame (in the previous version, it was “parented” as game.StarterGui.ScreenGui.Frame)

is this a loading screen as soon as the player joins? if so i’d approach it very differently. I don’t think playeradded even properly fires off of a gui when the player itself joins…

Regardless, if you want to access PlayerGui, its right on Player.PlayerGui, inside of playergui itll be structered the exact same as it was in startergui

2 Likes

IIRC (If I Remember Correctly), I made one LocalScript that fired and printed showcasing the player joining and leaving… But, continue further, yes, it is going to appear once the player spawns to the Baseplate!

You see, I tried doing that a bit before making this topic, yet, it gave me errors as it was not having the capacity to track the data class… Although, maybe as an alternative, this can work a bit?

Player gui is what the player sees and the place where changes to gui from scripts happens and Startergui is where you put it to replicate into all those players

I believe I got it in the first responses a bit above as PlayerGui being what the players see through the client and StarterGui restoring to players at the server… Although, I am still having difficulty applying the PlayerGui using the methods script.Parent.Frame + now Players:FindFirstChildOfClass("PlayerGui") above:

everything would be that as they are all children of a player gui

Everything as in for the variables that are parenting the frame, right?

player.LocalPlayer Added doesn’t work that well btw so i suggest detecting it on server then firing a remote which triggers the script

Yeah… I noticed that and immediately modified it! It looks like this now:

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
	print(player.UserId, player.Name, player.DisplayName, " joined the experience")
	
	local TextLabel = script.Parent.Frame or Players:FindFirstChildOfClass("PlayerGui"):FindFirstChild(script.Parent.Frame)
	TextLabel.BackgroundTransparency = 1
	TextLabel.Text = "Loading"
	TextLabel.TextScaled = true
	
	task.wait(5)
	
	for index=0.1,1,1 do
		TextLabel.BackgroundTransparency = index
		task.wait(0.01)
	end
	
	task.wait(1.75)
	
	print("Loaded.")
	
	local days = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}
	
	print("Today is " .. days[5])
end)

Where is this script located if it’s in Starter gui it won’t work?

It is located in StarterGui > ScreenGui… I can try re-locating the LocalScript to somewhere else such as StarterPlayer, yet nothing works.

local Script’s can’t do anything that the server can e.g check when a player is added

So, in this case, I would have to remove the Players.PlayerAdded fire event, right?

So what you can do is in replicated storage add in a remote event called 'Joined and in serverscript servcie add in a normal script then check when the player joins with game.Players.PlayerAdded:Connect(function(player) game.ReplicatedStorage.Joined:FireClient(player) end)

then in a local script in screen gui do


game.ReplicatedStorage.Joined.OnClientEvent:Connect(function()

    local TextLabel = script.Parent.Frame 
	TextLabel.BackgroundTransparency = 1
	TextLabel.Text = "Loading"
	TextLabel.TextScaled = true
	
	task.wait(5)
	
	for index=0.1,1,1 do
		TextLabel.BackgroundTransparency = index
		task.wait(0.01)
	end
	
	task.wait(1.75)
	
	print("Loaded.")
	
	local days = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}
	
	print("Today is " .. days[5])
end)

this should work I think

Worked a bit, but in the Output, it printed an error that destroyed the frame as not fading away in its specific moment:

image

Everything in startergui gets copied into playergui. Startergui is for you to be able to see and then the GUI gets copied in each player so they can individually screw around with it.

1 Like

frames don’t have a value of text you need to actually add something called a text label