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 » Scripters
Home Search
 

Re: PlayerAdded help please!

Previous Thread :: Next Thread 
UltimateRaheem is not online. UltimateRaheem
Joined: 10 Nov 2012
Total Posts: 1886
28 Dec 2015 01:38 PM
Okay, so I made an intro GUI where a GUI flys from the top of the screen, to the center, and then to the bottom. The GUI's are working fine because I am tweening. It tweens out perfectly because I call a .MouseButtton1Click function when the user clicks on a textbutton.

But as for the when the GUI tweens in to the center of the screen... It doesn't move. And I think I've found out the problem to it. The function I use is:

game.Players.PlayerAdded:connect(function()
Frame:TweenPosition(UDim2.new(0.5, -125, 0.5, -150), "In")
end)

I believe that I shouldn't use the player added function, but I don't know what function to use to make this GUI 'tween' in when a player joins.

Please help me out here.
Report Abuse
UltimateRaheem is not online. UltimateRaheem
Joined: 10 Nov 2012
Total Posts: 1886
28 Dec 2015 01:40 PM
I could remove the function and just increase the float time.. Would that help?
Report Abuse
AdvancedObjects is not online. AdvancedObjects
Joined: 11 Dec 2012
Total Posts: 3354
28 Dec 2015 01:41 PM
You can't use a playeradded event in a localscript.

To make this work just do it when the script loads because the script will load when the player loads (when they join).

function tween()
Frame:TweenPosition(UDim2.new(0.5, -125, 0.5, -150), "In", "Quad", 2, false)
end
tween()
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
28 Dec 2015 01:50 PM
You can use the PlayerAdded event locally*
Report Abuse
AdvancedObjects is not online. AdvancedObjects
Joined: 11 Dec 2012
Total Posts: 3354
28 Dec 2015 01:51 PM
^ there's no use for a playeradded event in a localscript.
Report Abuse
UltimateRaheem is not online. UltimateRaheem
Joined: 10 Nov 2012
Total Posts: 1886
28 Dec 2015 02:02 PM
Thanks advanced! You helped me out! I'm just trying to remove the screenGui after everything, just to make space... Any ideas?
Report Abuse
ZaltherusKenobi is not online. ZaltherusKenobi
Joined: 13 Jun 2012
Total Posts: 46
28 Dec 2015 02:05 PM
just make a variable for your screengui itself:
Player = game.Players.LocalPlayer
screen = Player.ScreenGui
screen:Remove()
(or you could put:)
screen:Destroy()

Defining the player and such was just part of the example.
Report Abuse
ZaltherusKenobi is not online. ZaltherusKenobi
Joined: 13 Jun 2012
Total Posts: 46
28 Dec 2015 02:05 PM
Sorry, I meant to define screen as
screen = Player.PlayerGui.ScreenGui
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
28 Dec 2015 02:07 PM
That's not what you said.

You can use PlayerAdded in a localscript but why'd anyone do it?
Report Abuse
ZaltherusKenobi is not online. ZaltherusKenobi
Joined: 13 Jun 2012
Total Posts: 46
28 Dec 2015 02:09 PM
Then I guess this could be classified as clickbait to help with something more.
Report Abuse
UltimateRaheem is not online. UltimateRaheem
Joined: 10 Nov 2012
Total Posts: 1886
28 Dec 2015 02:31 PM
Whenever I remove it and then I test it (I've made a server), The screenGui has been deleted and in the Output it says that my script's parent has been deleted (which is the screenGui).

Both starterGui and gui inside of the player have been deleted as soon as I enter the game because of the :Remove().

Is there a way of deleting it from the starterGui and the playerGui without deleting it straight away as soon as I enter the game?
Report Abuse
Judgmentum is not online. Judgmentum
Joined: 23 Aug 2015
Total Posts: 351
28 Dec 2015 02:35 PM
dont use :Remove()

use :Destroy()
Report Abuse
UltimateRaheem is not online. UltimateRaheem
Joined: 10 Nov 2012
Total Posts: 1886
28 Dec 2015 02:36 PM
What's the difference?
Report Abuse
Ripepperoni is not online. Ripepperoni
Joined: 04 Jul 2010
Total Posts: 5715
28 Dec 2015 02:39 PM
@Happy

If you wanted to make a gui displaying when a player joined

narb
Report Abuse
UltimateRaheem is not online. UltimateRaheem
Joined: 10 Nov 2012
Total Posts: 1886
28 Dec 2015 02:42 PM
Oh wait, I found out why :Remove() is worse than :Destroy()

Destroy removes the items and sets its parent to nil, removing the object and reducing lag.

Remove just makes the items parent nil, letting all of the scripts inside still work and function like they would if it wasn't nil.
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
28 Dec 2015 03:44 PM
I was trying to say that PlayerAdded works in localscripts
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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