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: THIS IS'NT WORKING!!!!

Previous Thread :: Next Thread 
LightFantom is online. LightFantom
Joined: 23 Sep 2014
Total Posts: 7830
25 Jan 2017 04:28 PM
game.Players.PlayerAdded:connect(function(plr)
plr.StarterGear:WaitForChild("SaveFolder")
local spins = plr.StarterGear.SaveFolder.Spins.Value

local level = plr.StarterGear.SaveFolder.Level.Value
local maxXP = plr.StarterGear.SaveFolder.MaxXP.Value
local currentXP = plr.StarterGear.SaveFolder.CurrentXP.Value
local level = plr.StarterGear.SaveFolder.Level.Value

while maxXP == currentXP.Value do


level = level +1

end
end)

it is supposed to give you one more level when you reach the max xp but its not working at all. And it shows no error...


Love breeds sacrifice... which in turn breeds hatred. Then you can know pain.
Report Abuse
ExtremeBuilder15 is online. ExtremeBuilder15
Joined: 01 May 2012
Total Posts: 3176
25 Jan 2017 04:46 PM
Lots of problems:
currentXP isn't a reference to the player's current xp, it's just a number of the xp the player has when that line of code runs.

level is defined twice.

There is no wait in the while loop, so it could crash the game.

You don't do anything to reset the xp or increase max xp after you give the player another level, so you'll get infinite levels.

This should work

game.Players.PlayerAdded:connect(function(plr)
plr.StarterGear:WaitForChild("SaveFolder")
local spins = plr.StarterGear.SaveFolder.Spins

local level = plr.StarterGear.SaveFolder.Level
local maxXP = plr.StarterGear.SaveFolder.MaxXP
local currentXP = plr.StarterGear.SaveFolder.CurrentXP

currentXP.Changed:connect(function()
if currentXP.Value >= maxXP.Value then
currentXP.Value = currentXP.Value - maxXP.Value
level.Value = level.Value + 1
end
end)

end
end)
Report Abuse
KritikalGunzz is not online. KritikalGunzz
Joined: 10 Nov 2013
Total Posts: 1633
25 Jan 2017 04:47 PM
Why are you using StarterGear, everything in that is cloned to the Backpack so use that instead
Report Abuse
ExtremeBuilder15 is online. ExtremeBuilder15
Joined: 01 May 2012
Total Posts: 3176
25 Jan 2017 04:48 PM
lol, forgot about that, you probably want to change that as well.
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