|
| 06 Jul 2015 05:24 PM |
player = game.Players.LocalPlayer Character = player.Character
xp = player.statnumbers.exp level = player.statnumbers.Level skillpoint = player.statnumbers.Sp def = player.statnumbers.Def dext = player.statnumbers.Dex int = player.statnumbers.Int str = player.statnumbers.Str
xp.Changed:connect(function() if xp.Value >= xp.Value * 40 then xp.Value = 0 level.Value = level.Value + 1 end level.Changed:connect(function() skillpoint.Value = skillpoint.Value + 2 def.Value = def.Value + 10 Character.Humanoid.MaxHealth = Character.Humanoid.MaxHealth + 10 Character.Humanoid.Health = Character.Humanoid.Health + 10 if player.statnumbers.warrior == true then wait() str.Value = str.Value + 1 elseif player.statnumbers.rogue == true then wait() dext.Value = dext.Value + 1 elseif player.statnumbers.wizard == true then wait() int.Value = int.Value + 1 end end) end)
*pulls at hair in frustration*
it's a localscript in startergui. my friend looked at it and said it should work and that the player is just not meeting the condition. i have a "fix exp" button that works when you click it; it does pretty much does the same thing as this but written slightly differently. i can post that if needed. |
|
|
| Report Abuse |
|
|
Dynerov
|
  |
| Joined: 21 Jul 2014 |
| Total Posts: 14682 |
|
| |
|
|
| 06 Jul 2015 05:42 PM |
http://prntscr.com/7pmq4v
the only error, which refers to this line:
Character.Humanoid.MaxHealth = Character.Humanoid.MaxHealth + 10
|
|
|
| Report Abuse |
|
|
Dynerov
|
  |
| Joined: 21 Jul 2014 |
| Total Posts: 14682 |
|
|
| 06 Jul 2015 05:44 PM |
Uhm, wow.
I have not seen a thing quite like that. |
|
|
| Report Abuse |
|
|
| |
|
|
| 06 Jul 2015 05:53 PM |
| at this point i don't know what to do...aaaaa lua hates me |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 06 Jul 2015 07:06 PM |
upd8:
if xp.Value >= xp.Value * 40 then
one problem was that i was comparing the value of player's xp to the value of player's xp * 40; supposed to be level * 40 which i fixed but now when a player levels, they get 100-150 or so skill points..idk whats going on q.q |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2015 07:31 PM |
| im thinking i need to add a debounce because its running too many times |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2015 07:32 PM |
You have to wait for character to load.
repeat wait() until game.Players.LocalPlayer.CharacterAdded player = game.Players.LocalPlayer Character = player.Character
xp = player.statnumbers.exp level = player.statnumbers.Level skillpoint = player.statnumbers.Sp def = player.statnumbers.Def dext = player.statnumbers.Dex int = player.statnumbers.Int str = player.statnumbers.Str
xp.Changed:connect(function() if xp.Value >= xp.Value * 40 then xp.Value = 0 level.Value = level.Value + 1 end level.Changed:connect(function() skillpoint.Value = skillpoint.Value + 2 def.Value = def.Value + 10 Character.Humanoid.MaxHealth = Character.Humanoid.MaxHealth + 10 Character.Humanoid.Health = Character.Humanoid.Health + 10 if player.statnumbers.warrior == true then wait() str.Value = str.Value + 1 elseif player.statnumbers.rogue == true then wait() dext.Value = dext.Value + 1 elseif player.statnumbers.wizard == true then wait() int.Value = int.Value + 1 end end) end) |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2015 08:17 PM |
| still gave me too much skill points..i think the problem's in the debounce, giving the player the difference in SP based excess XP they had from leveling..say a player has 1400/1500 XP. they kill a mob that gives them 200 XP and they'd gain 100 SP because the function keeps running. |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2015 08:25 PM |
| that's my theory anyway and its why im trying to integrate debounce into this |
|
|
| Report Abuse |
|
|
mycheeze
|
  |
| Joined: 27 Jun 2011 |
| Total Posts: 6748 |
|
|
| 06 Jul 2015 08:26 PM |
| qqqqq bb t'is fine, I luv u <3 |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 06 Jul 2015 08:36 PM |
Try this
local player = game.Players.LocalPlayer local char = player.Character local stats = player:WaitForChild("statsnumbers") local xp = stats:WaitForChild("XP") local level = stats:WaitForChild("Level") local skillpoint = stats:WaitForChild("Sp") local def = stats:WaitForChild("Def") local dext = stats:WaitForChild("Dex") local int = stats:WaitForChild("Int") local str = stats:WaitForChild("Str") local warrior = stats:WaitForChild("Warrior") local rogue = stats:WaitForChild("Rogue") local wizard = stats:WaitForChild("Wizard")
xp.Changed:connect(function() if xp.Value >= xp.Value * 40 then xp.Value = 0 level.Value = level.Value + 1 end end)
level.Changed:connect(function() skillpoint.Value = skillpoint.Value + 2 def.Value = def.Value + 10 char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + 10 char.Humanoid.Health = char.Humanoid.Health + 10 if warrior.Value then str.Value = str.Value + 1 elseif rogue.Value then dext.Value = dext.Value + 1 elseif wizard.Value then int.Value = int.Value + 1 end end)
"Talk is cheap. Show me the code." - Linus Torvalds |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2015 08:58 PM |
| ^ u forgot to wait for the character |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 06 Jul 2015 09:02 PM |
ill do it the old skool way
repeat wait() until player.Character
"Talk is cheap. Show me the code." - Linus Torvalds |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2015 09:10 PM |
| that worked except it randomly gives me 4 SP on some levels. thanks! |
|
|
| Report Abuse |
|
|