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: Shouldn't this work...?

Previous Thread :: Next Thread 
jonman11 is not online. 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
MARIOSTAR6464 is not online. MARIOSTAR6464
Joined: 21 Jul 2008
Total Posts: 13674
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 is not online. 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 is not online. Jeffe32
Joined: 30 Mar 2012
Total Posts: 1616
10 Feb 2013 09:27 AM
^ True
Report Abuse
jonman11 is not online. 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 is not online. 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
MARIOSTAR6464 is not online. MARIOSTAR6464
Joined: 21 Jul 2008
Total Posts: 13674
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
jjjj1111222 is not online. jjjj1111222
Joined: 17 Aug 2009
Total Posts: 1282
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 is not online. 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
jjjj1111222 is not online. jjjj1111222
Joined: 17 Aug 2009
Total Posts: 1282
10 Feb 2013 09:37 AM
Nevermind, don't use mine.
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