jonman11
|
  |
| Joined: 30 Jan 2010 |
| Total Posts: 3386 |
|
|
| 10 Feb 2013 09:23 AM |
This code is in a script inside a text label for a GUI.
It is designed to show the GUI briefly if you level up, yet it don't work. Does anyone know where the error is..?
if game.Players.Player.Level +1 then script.Parent.TextTransparency = 0 wait(3) script.Parent.TextTransparency = 1
end
|
|
|
| Report Abuse |
|
|
|
| 10 Feb 2013 09:25 AM |
Is thats the entire script?
If so, I suggest you learn a bit more Lua before trying to make scripts. |
|
|
| Report Abuse |
|
|
jonman11
|
  |
| Joined: 30 Jan 2010 |
| Total Posts: 3386 |
|
|
| 10 Feb 2013 09:27 AM |
The only way to LEARN is to TRY thank you very much..
Why? Should it be much longer? |
|
|
| Report Abuse |
|
|
Jeffe32
|
  |
| Joined: 30 Mar 2012 |
| Total Posts: 1616 |
|
| |
|
jonman11
|
  |
| Joined: 30 Jan 2010 |
| Total Posts: 3386 |
|
|
| 10 Feb 2013 09:33 AM |
| So does anyone have any help as to what I should do with this...? |
|
|
| Report Abuse |
|
|
8SunTzu8
|
  |
| Joined: 30 Sep 2011 |
| Total Posts: 8199 |
|
|
| 10 Feb 2013 09:33 AM |
if game.Players.Player.Level +1
--You're not providing an argument. Try storing the Player's level before you run this script, and then doing:
if game.Players.Player.Level == (Level + 1) then
then script.Parent.TextTransparency = 0
--Usually people put the if and then on the same line. I don't think it causes an error to do it another way, though.
wait(3) script.Parent.TextTransparency = 1 end
This sort of a script you made will fire once, and when it is initialized or when the Disabled property is set from true to false. If this is within another script, then it might be more useful, but it depends on if the rest of the script works.
Look for the events of various Values, specifically "Changed". If you can learn how to connect functions to events, and then create a function that will fire when the player's level is changed, you'll probably get what you're trying for.
"If you want to become a Developer or Innovator for CSA, contact me." |
|
|
| Report Abuse |
|
|
|
| 10 Feb 2013 09:34 AM |
Put it in a localscript:
game.Players.LocalPlayer.Level.Changed:connect(function() if game.Players.LocalPlayer.Level.Value >= 1 then --I assume level is just an int value in the player, if not, change to game.Players.LocalPlayer.leaderstats.Level.Value script.Parent.TextTransparency = 0 wait(3) script.Parent.TextTransparency = 1 end end) |
|
|
| Report Abuse |
|
|
|
| 10 Feb 2013 09:35 AM |
if game.Players.Player.Level +1 then script.Parent.TextTransparency = 0 wait(3) script.Parent.TextTransparency = 1
end
Your first line... there are two problems. This might be what you're attempting to do:
if game.Players.Player.Level == game.Players.Player.Level + 1 then |
|
|
| Report Abuse |
|
|
8SunTzu8
|
  |
| Joined: 30 Sep 2011 |
| Total Posts: 8199 |
|
|
| 10 Feb 2013 09:36 AM |
@jjjj1111222,
I don't think game.Players.Player.Level will ever be equal to game.Players.Player.Level + 1.
:p
"If you want to become a Developer or Innovator for CSA, contact me." |
|
|
| Report Abuse |
|
|
|
| 10 Feb 2013 09:37 AM |
| Nevermind, don't use mine. |
|
|
| Report Abuse |
|
|