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 » Scripters
Home Search
 

Re: what's wrong with this?

Previous Thread :: Next Thread 
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
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 is not online. Dynerov
Joined: 21 Jul 2014
Total Posts: 14682
06 Jul 2015 05:32 PM
check for any errors
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
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 is not online. 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
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
06 Jul 2015 05:45 PM
qqqqq
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
06 Jul 2015 05:53 PM
at this point i don't know what to do...aaaaa lua hates me
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
06 Jul 2015 06:07 PM
bump
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
06 Jul 2015 06:44 PM
b2
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
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
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
06 Jul 2015 07:31 PM
im thinking i need to add a debounce because its running too many times
Report Abuse
XtremeTemper is not online. XtremeTemper
Joined: 02 Mar 2012
Total Posts: 1774
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
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
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
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
06 Jul 2015 08:25 PM
that's my theory anyway and its why im trying to integrate debounce into this
Report Abuse
mycheeze is not online. 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 is not online. 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
XtremeTemper is not online. XtremeTemper
Joined: 02 Mar 2012
Total Posts: 1774
06 Jul 2015 08:58 PM
^ u forgot to wait for the character
Report Abuse
TimeTicks is not online. 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
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
06 Jul 2015 09:10 PM
that worked except it randomly gives me 4 SP on some levels. thanks!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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