Hello, everyone! I hope you all are having a wonderful day!
Recently, I was simply making a testing frame within a baseplate at the studio engine, and once scripting for short, my head immediately noticed somethingâŚ
After making a few lines with the data class type StarterGui, I begin to think: âWait, why am I using StarterGui? I shouldâve used PlayerGui for it!â. One of my latest topics I made under this subcategory had a few individual developers talking about this class PlayerGui and that it would be good to use it⌠But, the only one thing that breaks my brain is how I can apply it and/or how I can understand the difference between this + StarterGui properly due to lack of information about itâŚ
StarterGui. Think of it like a folder that contains GUI. This GUI is cloned to the player from the server on join. PlayerGUI, the Gui on the clientâs screen, is what you should be managing instead.
Got it, and how do I insert PlayerGui in my script? Because I tried like, making the same things as I did to the âfolderâ that âclonedâ the serverâs GUIs and it did not work⌠XD
Also, another thing to mention is that I usually get confused as well with task.wait() and wait(), so I only apply the old type
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âŚ
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
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:
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)