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: Math problem.

Previous Thread :: Next Thread 
spinywind is online. spinywind
Joined: 26 Jan 2012
Total Posts: 3580
09 Nov 2016 01:40 PM
Im trying to get this to make the text = the xp that was added but everytime it gets 100 higher when i increase by 100.


local XpGui = script.Parent.LevelObjects.XpGui
local Active = false
game.Players.PlayerAdded:connect(function(Player)
wait(1)
local LocalPlayerStats = game.ServerStorage["Player Stats"]:WaitForChild(Player.Name)
local PlayerStats = game.ServerStorage["Player Stats"]
local XP = LocalPlayerStats.XP
local XpValues = script.XpValues:Clone()
XpValues.Parent = PlayerStats
XpValues.Name = "XpValues-"..Player.Name
local OldXp = XpValues.OldXp
OldXp.Value = XP.Value
XP.Changed:connect(function()
wait(0.1)
if XP.Value == OldXp.Value then
local XpAdded = XpValues.XpAdded
XpAdded.Value = (XP.Value - OldXp.Value)
local PreXp = XpValues.PreXp
PreXp.Value = (XP.Value - OldXp.Value)
local XPGui = XpGui:Clone()
XPGui.Parent = Player.PlayerGui
XPGui.XpV.Text = (XpAdded.Value)
elseif XP.Value > OldXp.Value then
local XpAdded = XpValues.XpAdded
local PreXp = XpValues.PreXp
XpAdded.Value = (XP.Value - PreXp.Value)
PreXp.Value = (XP.Value - XpAdded.Value)
XpAdded.Value = (XP.Value - PreXp.Value)
local XPGui = XpGui:Clone()
XPGui.Parent = Player.PlayerGui
XPGui.XpV.Text = (XpAdded.Value)
end;
end);
end);


Report Abuse
spinywind is online. spinywind
Joined: 26 Jan 2012
Total Posts: 3580
09 Nov 2016 01:57 PM
So basically if a player gains 100 xp, i want the Text to say + 100 which on the first time the player gains xp, its right but not anytime after that.


Report Abuse
spinywind is online. spinywind
Joined: 26 Jan 2012
Total Posts: 3580
09 Nov 2016 02:03 PM
b


Report Abuse
spinywind is online. spinywind
Joined: 26 Jan 2012
Total Posts: 3580
09 Nov 2016 02:43 PM
b


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