|
| 12 Aug 2016 09:10 PM |
So I made a simple script: local gui = Instance.new("ScreenGui", game.StarterGui) gui.Name = ("MainScript")
And when the game loads I can see the MainScript in the StarterGui, but not in PlayerGui.
Can anyone help me with this? |
|
|
| Report Abuse |
|
|
Serphos
|
  |
| Joined: 11 Apr 2010 |
| Total Posts: 141 |
|
|
| 12 Aug 2016 09:12 PM |
Is it not in the PlayerGui if you reset?
|
|
|
| Report Abuse |
|
|
|
| 12 Aug 2016 09:13 PM |
The rest of the script is.. Local Frame = Instance.new("Frame", game.Players.LocalPlayer.PlayerGui.MainScript)
and in the output it says: MainScript isn't part of PlayerGui. |
|
|
| Report Abuse |
|
|
|
| 12 Aug 2016 09:14 PM |
Most likely, it's a problem with the timing. You see, the script fires after the game loads, which means that the player already received the starter gui stuff. Because of this, the player doesn't get the ScreenGui. You should probably just put a screen gui inside the starter gui. However, if you're doing this for practice, have the screen gui appear inside your gui. |
|
|
| Report Abuse |
|
|
|
| 12 Aug 2016 09:15 PM |
| @Serphos it is, but is there a way to make it show up without making the person reset? |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 12 Aug 2016 09:16 PM |
yes. You directly modify the playergui rather than the startergui.
for i,v in next, game.Players:GetPlayers() do v.PlayerGui:WaitForChild('ScreenGui').Frame.Visible = true end
|
|
|
| Report Abuse |
|
|
Serphos
|
  |
| Joined: 11 Apr 2010 |
| Total Posts: 141 |
|
|
| 12 Aug 2016 09:18 PM |
It's messy but you could do this instead of placing in StarterGui:
for _,v in pairs(game:GetPlayers()) do gui.Parent = v.PlayerGui end
|
|
|
| Report Abuse |
|
|
|
| 12 Aug 2016 09:19 PM |
| Or, alternatively, you could make it clone a copy to both the StarterGui AND the Player's Gui. To do this, establish an event where when a player enters, the script sends a copy to the Player's gui, another copy to the StarterGui, then it deletes itself. |
|
|
| Report Abuse |
|
|
Serphos
|
  |
| Joined: 11 Apr 2010 |
| Total Posts: 141 |
|
|
| 12 Aug 2016 09:21 PM |
You could do that but check if it's already in StarterGui so no duplicates are made using:
if game.StarterGui:FindFirstChild(whatever) then
|
|
|
| Report Abuse |
|
|
sadman
|
  |
| Joined: 14 Aug 2006 |
| Total Posts: 7 |
|
|
| 12 Aug 2016 09:47 PM |
wait() local g = Instance.new("ScreenGui", game.StarterGui) g.Name = "Main" local F = Instance.new("Frame", g) F.Name = "Frame1"
??? |
|
|
| Report Abuse |
|
|