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: Need Help on a "Stat Cap Script"

Previous Thread :: Next Thread 
captinsoap is not online. captinsoap
Joined: 24 Jan 2010
Total Posts: 9570
20 Jun 2012 03:01 AM
Hello, I am in need of a script that if you reach a chosen value it will not let you gain any more of the stat. I can not write the script since i have not scripted in a long time. If you can help it will be greatly appericated. Thankyou
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
20 Jun 2012 03:03 AM
while true do
wait()
if stat.Value > 5 then
stat.Value = 5 then --Put the max here
end
end
Report Abuse
captinsoap is not online. captinsoap
Joined: 24 Jan 2010
Total Posts: 9570
20 Jun 2012 03:04 AM
Thankyou i will try it out.
Report Abuse
captinsoap is not online. captinsoap
Joined: 24 Jan 2010
Total Posts: 9570
20 Jun 2012 03:05 AM
Do i place this in a Localscript or normal script?
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
20 Jun 2012 03:06 AM
You need to define stat. If that stat is inside a player than you need local.
Report Abuse
captinsoap is not online. captinsoap
Joined: 24 Jan 2010
Total Posts: 9570
20 Jun 2012 03:23 AM
Well it did not work. I have an RPG and i want a Lvl cap script. That if you reach say level 100 it will not let you go any further.
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
20 Jun 2012 03:26 AM
while true do
wait()
if game.Players.LocalPlayer.leaderstats.Level.Value > 100 then --Check the path
stat.Value = 100 then --Put the max here
end
end
Report Abuse
captinsoap is not online. captinsoap
Joined: 24 Jan 2010
Total Posts: 9570
20 Jun 2012 03:58 AM
That did not work so i guess i will not have a Max Level ;l
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
20 Jun 2012 03:59 AM
Yea because you didn't check the path

while true do
wait()
if game.Players.LocalPlayer.leaderstats.Level.Value > 100 then
game.Players.LocalPlayer.leaderstats.Level.Value = 100
end
end
Report Abuse
captinsoap is not online. captinsoap
Joined: 24 Jan 2010
Total Posts: 9570
20 Jun 2012 04:01 AM
Oh, Sorry
Report Abuse
Solotaire is not online. Solotaire
Joined: 30 Jul 2009
Total Posts: 30356
20 Jun 2012 04:02 AM
@Cheater,
You need to wait for the player to be ready before you can start that. A different script assigns the leaderstats, so either

a) Put a wait at the start of the script for some amount of time (1-5 seconds).
b) Add an if statement to check that the level even exists.

Or no? I might be wrong.
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
20 Jun 2012 04:04 AM
If the place is laggy, your scripts are necessary.
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
20 Jun 2012 04:05 AM
Omg I just read this at my post:


I can't even post it. Unexpected error.
Report Abuse
captinsoap is not online. captinsoap
Joined: 24 Jan 2010
Total Posts: 9570
20 Jun 2012 04:25 AM
Does not work. I dont know why, If its because I have not checked the path.
I dont know really because I dont know how to check the path.
And I just copied your post and pasted it into a local script. I dont really get it or its just that code does not work.
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
20 Jun 2012 04:26 AM
Maybe that "Level" you mean, is not called "Level". Maybe it has another name or something and maybe you also use an EXP something etc. etc.
Report Abuse
captinsoap is not online. captinsoap
Joined: 24 Jan 2010
Total Posts: 9570
20 Jun 2012 04:28 AM
I changed Level to the one in my game (Lvl). And i do have XP stat.
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
20 Jun 2012 04:30 AM
Why do you even want a blocker?
Report Abuse
captinsoap is not online. captinsoap
Joined: 24 Jan 2010
Total Posts: 9570
20 Jun 2012 04:32 AM
If you mean cap, I want it for my RPG so people cant get levels like 99999999.
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
20 Jun 2012 04:35 AM
wait(5)

while true do
wait()
if game.Players.LocalPlayer.leaderstats.Lvl.Value > 100 then
game.Players.LocalPlayer.leaderstats.Lvl.Value = 100
end
end

Just some waiting stuff.
Report Abuse
captinsoap is not online. captinsoap
Joined: 24 Jan 2010
Total Posts: 9570
20 Jun 2012 06:25 AM
Does not work :l guess im going without a script ;(
Report Abuse
Trioxide is not online. Trioxide
Joined: 29 Mar 2011
Total Posts: 32902
20 Jun 2012 07:18 AM
[ Content Deleted ]
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
20 Jun 2012 09:03 AM
@cheater,

Personally I'd do a .Changed() not while true do

More effecient =P
Report Abuse
Mathman314 is not online. Mathman314
Joined: 31 Jul 2009
Total Posts: 556
20 Jun 2012 10:33 AM
Yeah, I was even wondering why you were doing a loop when the .Changed event is so much better to use in this case.

@captain, you don't need parameters with the .Changed event, so therefore, it's just .Changed, not .Changed().

@OP, your script should be somewhere along the lines of:

level = ~put path name here~
max = ~whatever number you want the max level to be~
level.Changed:connect(function()
if level.Value > max then
level.Value = max
end
end)
Report Abuse
captinsoap is not online. captinsoap
Joined: 24 Jan 2010
Total Posts: 9570
20 Jun 2012 05:20 PM
Im sorry, what do you mean by path?
Report Abuse
captinsoap is not online. captinsoap
Joined: 24 Jan 2010
Total Posts: 9570
21 Jun 2012 12:40 AM
Hello?
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