generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: **Simple question if you may answer

Previous Thread :: Next Thread 
jonjon55 is not online. jonjon55
Joined: 24 Oct 2009
Total Posts: 78
29 Dec 2013 04:45 PM
Hello, I have a question about GUI's. Sometimes when I create gui's for a game introduction it displays the gui to my character and it works fine, but why is it when I die it re-shows the gui again. Is there a way I could make that stop? I might sound stupid for asking this. but your knowledge would help :)

- thanks
Report Abuse
Dexterityz is not online. Dexterityz
Joined: 23 Oct 2013
Total Posts: 817
29 Dec 2013 04:52 PM
I know why, its hard to put into words. Someone will correct me I know it.

Anyways, so when ever the Character Spawns again, it resets the GUI. Does the same if you were to leave too. I'm not sure if I know how to prevent this, but I think you may have to make it nil after it's been shown, or try using :Destroy() instead of :remove(). I believe :Destroy() works. I was told remove makes it still in workspace, but not present to the player(s) and Destroy removes it from the game.

"Don't walk behind me, I may not lead. Don't walk in front of me, I may not follow. Just walk beside me and be my friend."
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
29 Dec 2013 04:55 PM

The best way to do this is to use the CharacterAdded event, along with the PlayerAdded event to only show the GUI once (when they first enter the game). If you put the GUI inside StarterGui, it will show every time the player spawns.


game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:wait()
GUI:Clone().Parent = p.PlayerGui
end)
Report Abuse
jonjon55 is not online. jonjon55
Joined: 24 Oct 2009
Total Posts: 78
29 Dec 2013 04:57 PM
Yeah, Thanks guys:) that's all I need
Report Abuse
KiwiMeister is not online. KiwiMeister
Joined: 18 Feb 2010
Total Posts: 1464
29 Dec 2013 04:58 PM
at the end of the into gui..


frame = script.Parent
Gui = frame.Parent
Gui:Destroy()
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
29 Dec 2013 04:58 PM
You're kind of right. When a player's character dies their playergui is cleared.
The reason it is showing up after they spawn is because you put it in startergui.

Everything in startergui is cloned into every players playergui every time they spawn.

Destroy. Will remove an item and LOCK its parent.
Remove will remove an item and not lock its parent

So:
H:Destroy()
H.Parent = Workspace --Error

H:Remove()
H.Parent = Workspace -- is fine



In order for it to only show up once you have to use a script:

----------------------------------------------------------------------------

--Put Intro Guis inside this script

function Give(Player)
for _,n in pairs(script:GetChildren()) do
n:Clone().Parent = Player.PlayerGui
end
end
Game.Players.PlayerAdded:connect(Give)
for _,n in pairs(Game.Players:GetPlayers()) do Give(n) end
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image