|
| 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 |
|
|
|
| 28 Dec 2015 01:40 PM |
| I could remove the function and just increase the float time.. Would that help? |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 28 Dec 2015 01:50 PM |
| You can use the PlayerAdded event locally* |
|
|
| Report Abuse |
|
|
|
| 28 Dec 2015 01:51 PM |
| ^ there's no use for a playeradded event in a localscript. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 28 Dec 2015 02:05 PM |
Sorry, I meant to define screen as screen = Player.PlayerGui.ScreenGui |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 28 Dec 2015 02:09 PM |
| Then I guess this could be classified as clickbait to help with something more. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 28 Dec 2015 02:35 PM |
dont use :Remove()
use :Destroy() |
|
|
| Report Abuse |
|
|
| |
|
|
| 28 Dec 2015 02:39 PM |
@Happy
If you wanted to make a gui displaying when a player joined
narb |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 28 Dec 2015 03:44 PM |
| I was trying to say that PlayerAdded works in localscripts |
|
|
| Report Abuse |
|
|