|
| 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
|
  |
| 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 |
|
|
|
| 20 Jun 2012 03:04 AM |
| Thankyou i will try it out. |
|
|
| Report Abuse |
|
|
|
| 20 Jun 2012 03:05 AM |
| Do i place this in a Localscript or normal script? |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 20 Jun 2012 03:58 AM |
| That did not work so i guess i will not have a Max Level ;l |
|
|
| Report Abuse |
|
|
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 |
|
|
| |
|
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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 20 Jun 2012 04:30 AM |
| Why do you even want a blocker? |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 20 Jun 2012 06:25 AM |
| Does not work :l guess im going without a script ;( |
|
|
| Report Abuse |
|
|
Trioxide
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
| |
|
|
| 20 Jun 2012 09:03 AM |
@cheater,
Personally I'd do a .Changed() not while true do
More effecient =P |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 20 Jun 2012 05:20 PM |
| Im sorry, what do you mean by path? |
|
|
| Report Abuse |
|
|
| |
|